Merge pull request #31531 from akien-mga/3.1

Assorted cherry-picks from the master branch for Godot 3.1.2
This commit is contained in:
Rémi Verschelde 2019-09-24 10:05:49 +02:00 committed by GitHub
commit 300838dad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
78 changed files with 512 additions and 346 deletions

View File

@ -344,13 +344,14 @@ if selected_platform in platform_list:
version = methods.get_compiler_version(env)
if version != None and version[0] >= '7':
shadow_local_warning = ['-Wshadow-local']
if (env["warnings"] == 'extra'):
# FIXME: enable -Wimplicit-fallthrough once #26135 is fixed
# FIXME: enable -Wclobbered once #26351 is fixed
env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-implicit-fallthrough', '-Wno-unused-parameter'] + all_plus_warnings + shadow_local_warning)
# Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
# once we switch to C++11 or later (necessary for our FALLTHROUGH macro).
env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-unused-parameter'] + all_plus_warnings + shadow_local_warning)
if methods.using_gcc(env):
env['CCFLAGS'] += ['-Wno-clobbered']
elif (env["warnings"] == 'all'):
env.Append(CCFLAGS=['-Wall'] + shadow_local_warning)
elif (env["warnings"] == 'moderate'):

View File

@ -46,7 +46,8 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
case MultiplayerAPI::RPC_MODE_MASTERSYNC: {
if (is_master)
r_skip_rpc = true; // I am the master, so skip remote call.
} // Do not break, fall over to other sync.
FALLTHROUGH;
}
case MultiplayerAPI::RPC_MODE_REMOTESYNC:
case MultiplayerAPI::RPC_MODE_PUPPETSYNC: {
// Call it, sync always results in a local call.

View File

@ -224,7 +224,8 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
string_cache[s] = tmpdata.size();
}; //fallthrough
FALLTHROUGH;
};
case Variant::NIL:
case Variant::BOOL:
case Variant::INT:

View File

@ -968,6 +968,19 @@ String TranslationServer::get_locale_name(const String &p_locale) const {
return locale_name_map[p_locale];
}
Array TranslationServer::get_loaded_locales() const {
Array locales;
for (const Set<Ref<Translation> >::Element *E = translations.front(); E; E = E->next()) {
const Ref<Translation> &t = E->get();
String l = t->get_locale();
locales.push_back(l);
}
return locales;
}
Vector<String> TranslationServer::get_all_locales() {
Vector<String> locales;
@ -1168,6 +1181,8 @@ void TranslationServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_translation", "translation"), &TranslationServer::remove_translation);
ClassDB::bind_method(D_METHOD("clear"), &TranslationServer::clear);
ClassDB::bind_method(D_METHOD("get_loaded_locales"), &TranslationServer::get_loaded_locales);
}
void TranslationServer::load_translations() {

View File

@ -94,6 +94,8 @@ public:
String get_locale_name(const String &p_locale) const;
Array get_loaded_locales() const;
void add_translation(const Ref<Translation> &p_translation);
void remove_translation(const Ref<Translation> &p_translation);

View File

@ -331,7 +331,28 @@ struct _GlobalLock {
/** This is needed due to a strange OpenGL API that expects a pointer
* type for an argument that is actually an offset.
*/
#define CAST_INT_TO_UCHAR_PTR(ptr) ((uint8_t *)(uintptr_t)(ptr))
/** Hint for compilers that this fallthrough in a switch is intentional.
* Can be replaced by [[fallthrough]] annotation if we move to C++17.
* Including conditional support for it for people who set -std=c++17
* themselves.
* Requires a trailing semicolon when used.
*/
#if __cplusplus >= 201703L
#define FALLTHROUGH [[fallthrough]]
#elif defined(__GNUC__) && __GNUC__ >= 7
#define FALLTHROUGH __attribute__((fallthrough))
#elif defined(__llvm__) && __cplusplus >= 201103L && defined(__has_feature)
#if __has_feature(cxx_attributes) && defined(__has_warning)
#if __has_warning("-Wimplicit-fallthrough")
#define FALLTHROUGH [[clang::fallthrough]]
#endif
#endif
#endif
#ifndef FALLTHROUGH
#define FALLTHROUGH
#endif
#endif // TYPEDEFS_H

View File

@ -3297,7 +3297,7 @@ String String::http_unescape() const {
if ((ord1 >= '0' && ord1 <= '9') || (ord1 >= 'A' && ord1 <= 'Z')) {
CharType ord2 = ord_at(i + 2);
if ((ord2 >= '0' && ord2 <= '9') || (ord2 >= 'A' && ord2 <= 'Z')) {
char bytes[2] = { (char)ord1, (char)ord2 };
char bytes[3] = { (char)ord1, (char)ord2, 0 };
res += (char)strtol(bytes, NULL, 16);
i += 2;
}

View File

@ -1542,6 +1542,9 @@ Error VariantParser::parse_tag_assign_eof(Stream *p_stream, int &line, String &r
} else if (c != '=') {
what += String::chr(c);
} else {
if (p_stream->is_utf8()) {
what.parse_utf8(what.ascii(true).get_data());
}
r_assign = what;
Token token;
get_token(p_stream, token, line, r_err_str);

View File

@ -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++) {

View File

@ -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) {

View File

@ -936,7 +936,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
if (frame != prev_frame && i >= prev_frame_ofs) {
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor);
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
draw_string(font, Point2(get_name_limit() + i + 3 * EDSCALE, (h - font->get_height()) / 2 + font->get_ascent()).floor(), itos(frame), sub ? color_time_dec : color_time_sec, zoomw - i);
prev_frame_ofs = i + font->get_string_size(itos(frame)).x + 5 * EDSCALE;
@ -957,13 +957,13 @@ void AnimationTimelineEdit::_notification(int p_what) {
if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) {
int scd = sc < 0 ? prev_sc : sc;
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor);
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height()) / 2 + font->get_ascent()).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), sub ? color_time_dec : color_time_sec, zoomw - i);
}
}
}
draw_line(Vector2(0, get_size().height), get_size(), linecolor);
draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
}
}
@ -1047,7 +1047,7 @@ void AnimationTimelineEdit::_play_position_draw() {
if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) {
Color color = get_color("accent_color", "Editor");
play_position->draw_line(Point2(px, 0), Point2(px, h), color);
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(EDSCALE));
}
}
@ -1316,7 +1316,7 @@ void AnimationTrackEdit::_notification(int p_what) {
string_pos = string_pos.floor();
draw_string(font, string_pos, text, text_color, limit - ofs - hsep);
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor);
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
}
// KEYFAMES //
@ -1376,7 +1376,7 @@ void AnimationTrackEdit::_notification(int p_what) {
Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor);
draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep;
{
@ -1423,7 +1423,7 @@ void AnimationTrackEdit::_notification(int p_what) {
}
ofs += down_icon->get_width();
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor);
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep;
}
@ -1456,7 +1456,7 @@ void AnimationTrackEdit::_notification(int p_what) {
}
ofs += down_icon->get_width();
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor);
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep;
}
@ -1489,7 +1489,7 @@ void AnimationTrackEdit::_notification(int p_what) {
}
ofs += down_icon->get_width();
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor);
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep;
}
@ -1507,17 +1507,17 @@ void AnimationTrackEdit::_notification(int p_what) {
}
if (in_group) {
draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor);
draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor, Math::round(EDSCALE));
} else {
draw_line(Vector2(0, get_size().height), get_size(), linecolor);
draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
}
if (dropping_at != 0) {
Color drop_color = get_color("accent_color", "Editor");
if (dropping_at < 0) {
draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color);
draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE));
} else {
draw_line(Vector2(0, get_size().height), get_size(), drop_color);
draw_line(Vector2(0, get_size().height), get_size(), drop_color, Math::round(EDSCALE));
}
}
}
@ -1566,7 +1566,7 @@ void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x,
int from_x = MAX(p_x, p_clip_left);
int to_x = MIN(p_next_x, p_clip_right);
draw_line(Point2(from_x + 1, get_size().height / 2), Point2(to_x, get_size().height / 2), color, 2);
draw_line(Point2(from_x + 1, get_size().height / 2), Point2(to_x, get_size().height / 2), color, Math::round(2 * EDSCALE));
}
void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
@ -1746,7 +1746,7 @@ void AnimationTrackEdit::_play_position_draw() {
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
Color color = get_color("accent_color", "Editor");
play_position->draw_line(Point2(px, 0), Point2(px, h), color);
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(EDSCALE));
}
}
@ -2449,9 +2449,9 @@ void AnimationTrackEditGroup::_notification(int p_what) {
Color linecolor = color;
linecolor.a = 0.2;
draw_line(Point2(), Point2(get_size().width, 0), linecolor);
draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), linecolor);
draw_line(Point2(get_size().width - timeline->get_buttons_width(), 0), Point2(get_size().width - timeline->get_buttons_width(), get_size().height), linecolor);
draw_line(Point2(), Point2(get_size().width, 0), linecolor, Math::round(EDSCALE));
draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), linecolor, Math::round(EDSCALE));
draw_line(Point2(get_size().width - timeline->get_buttons_width(), 0), Point2(get_size().width - timeline->get_buttons_width(), get_size().height), linecolor, Math::round(EDSCALE));
int ofs = 0;
draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
@ -2462,7 +2462,7 @@ void AnimationTrackEditGroup::_notification(int p_what) {
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
Color accent = get_color("accent_color", "Editor");
draw_line(Point2(px, 0), Point2(px, get_size().height), accent);
draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(EDSCALE));
}
}
}

View File

@ -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) {

View File

@ -1901,7 +1901,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
break;
}
} // fallthrough
FALLTHROUGH;
}
case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE: {
@ -1920,8 +1921,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
break;
}
// fallthrough to save_as
};
FALLTHROUGH;
}
case FILE_SAVE_AS_SCENE: {
int scene_idx = (p_option == FILE_SAVE_SCENE || p_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;

View File

@ -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());

View File

@ -1257,7 +1257,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale));
}
scene->set_name(p_options["nodes/root_name"]);
if (p_options["nodes/root_name"] != "Scene Root")
scene->set_name(p_options["nodes/root_name"]);
else
scene->set_name(p_save_path.get_file().get_basename());
err = OK;

View File

@ -35,6 +35,9 @@
#include "core/os/file_access.h"
#include "scene/resources/audio_stream_sample.h"
const float TRIM_DB_LIMIT = -50;
const int TRIM_FADE_OUT_FRAMES = 500;
String ResourceImporterWAV::get_importer_name() const {
return "wav";
@ -393,11 +396,17 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
if (trim && !loop && format_channels > 0) {
int first = 0;
int last = (frames * format_channels) - 1;
int last = (frames / format_channels) - 1;
bool found = false;
float limit = Math::db2linear((float)-30);
for (int i = 0; i < data.size(); i++) {
float amp = Math::abs(data[i]);
float limit = Math::db2linear(TRIM_DB_LIMIT);
for (int i = 0; i < data.size() / format_channels; i++) {
float ampChannelSum = 0;
for (int j = 0; j < format_channels; j++) {
ampChannelSum += Math::abs(data[(i * format_channels) + j]);
}
float amp = Math::abs(ampChannelSum / (float)format_channels);
if (!found && amp > limit) {
first = i;
@ -409,15 +418,20 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
first /= format_channels;
last /= format_channels;
if (first < last) {
Vector<float> new_data;
new_data.resize((last - first + 1) * format_channels);
for (int i = first * format_channels; i < (last + 1) * format_channels; i++) {
new_data.write[i - first * format_channels] = data[i];
new_data.resize((last - first) * format_channels);
for (int i = first; i < last; i++) {
float fadeOutMult = 1;
if (last - i < TRIM_FADE_OUT_FRAMES) {
fadeOutMult = ((float)(last - i - 1) / (float)TRIM_FADE_OUT_FRAMES);
}
for (int j = 0; j < format_channels; j++) {
new_data.write[((i - first) * format_channels) + j] = data[(i * format_channels) + j] * fadeOutMult;
}
}
data = new_data;

View File

@ -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);
}
}
}

View File

@ -481,6 +481,17 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
if (edited_point.valid() && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) {
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
//Move the point in a single axis. Should only work when editing a polygon and while holding shift.
if (mode == MODE_EDIT && mm->get_shift()) {
Vector2 old_point = pre_move_edit.get(selected_point.vertex);
if (ABS(cpoint.x - old_point.x) > ABS(cpoint.y - old_point.y)) {
cpoint.y = old_point.y;
} else {
cpoint.x = old_point.x;
}
}
edited_point = PosVertex(edited_point, cpoint);
if (!wip_active) {

View File

@ -874,9 +874,9 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
}
to.y = from.y;
float len = MAX(0.0001, playback->get_current_length());
float len = MAX(0.0001, current_length);
float pos = CLAMP(playback->get_current_play_pos(), 0, len);
float pos = CLAMP(play_pos, 0, len);
float c = pos / len;
Color fg = get_color("font_color", "Label");
Color bg = fg;
@ -1011,7 +1011,8 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
bool is_playing = false;
StringName current_node;
StringName blend_from_node;
float play_pos = 0;
play_pos = 0;
current_length = 0;
if (playback.is_valid()) {
tp = playback->get_travel_path();
@ -1019,6 +1020,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
current_node = playback->get_current_node();
blend_from_node = playback->get_blend_from_node();
play_pos = playback->get_current_play_pos();
current_length = playback->get_current_length();
}
{
@ -1046,6 +1048,27 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
state_machine_play_pos->update();
}
{
if (current_node != StringName() && state_machine->has_node(current_node)) {
String next = current_node;
Ref<AnimationNodeStateMachine> anodesm = state_machine->get_node(next);
Ref<AnimationNodeStateMachinePlayback> current_node_playback;
while (anodesm.is_valid()) {
current_node_playback = AnimationTreeEditor::get_singleton()->get_tree()->get(AnimationTreeEditor::get_singleton()->get_base_path() + next + "/playback");
next += "/" + current_node_playback->get_current_node();
anodesm = anodesm->get_node(current_node_playback->get_current_node());
}
// when current_node is a state machine, use playback of current_node to set play_pos
if (current_node_playback.is_valid()) {
play_pos = current_node_playback->get_current_play_pos();
current_length = current_node_playback->get_current_length();
}
}
}
if (last_play_pos != play_pos) {
last_play_pos = play_pos;

View File

@ -160,6 +160,8 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
StringName last_current_node;
Vector<StringName> last_travel_path;
float last_play_pos;
float play_pos;
float current_length;
float error_time;
String error_text;

View File

@ -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);

View File

@ -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);
}
@ -2275,6 +2275,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
break;
case DRAG_PAN:
c = CURSOR_DRAG;
break;
default:
break;
}
@ -2611,6 +2612,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_TOP_LEFT:
case DRAG_BOTTOM_LEFT:
_draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
FALLTHROUGH;
case DRAG_MOVE:
start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
@ -2625,6 +2627,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_TOP_RIGHT:
case DRAG_BOTTOM_RIGHT:
_draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
FALLTHROUGH;
case DRAG_MOVE:
start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
@ -2639,6 +2642,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_TOP_LEFT:
case DRAG_TOP_RIGHT:
_draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
FALLTHROUGH;
case DRAG_MOVE:
start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
end = start - Vector2(0, control->get_margin(MARGIN_TOP));
@ -2653,6 +2657,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_BOTTOM_LEFT:
case DRAG_BOTTOM_RIGHT:
_draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
FALLTHROUGH;
case DRAG_MOVE:
start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));

View File

@ -849,8 +849,7 @@ void ScriptEditor::_file_dialog_action(String p_file) {
}
file->close();
memdelete(file);
// fallthrough to open the file.
FALLTHROUGH;
}
case FILE_OPEN: {
@ -1689,7 +1688,19 @@ void ScriptEditor::_update_script_names() {
Ref<Texture> icon = se->get_icon();
String path = se->get_edited_resource()->get_path();
bool built_in = !path.is_resource_file();
String name = built_in ? path.get_file() : se->get_name();
String name;
if (built_in) {
name = path.get_file();
String resource_name = se->get_edited_resource()->get_name();
if (resource_name != "") {
name = name.substr(0, name.find("::", 0) + 2) + resource_name;
}
} else {
name = se->get_name();
}
_ScriptEditorItemData sd;
sd.icon = icon;

View File

@ -997,7 +997,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
tx->set_line_as_breakpoint(line, dobreak);
ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), line + 1, dobreak);
}
}
} break;
case DEBUG_GOTO_NEXT_BREAKPOINT: {
List<int> bpoints;

View File

@ -1824,7 +1824,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!sp)
continue;
emit_signal("transform_key_request", sp, "", sp->get_transform());
spatial_editor->emit_signal("transform_key_request", sp, "", sp->get_transform());
}
set_message(TTR("Animation Key Inserted."));
@ -5811,7 +5811,7 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) {
editor->get_viewport()->add_child(spatial_editor);
spatial_editor->hide();
spatial_editor->connect("transform_key_request", editor, "_transform_keyed");
spatial_editor->connect("transform_key_request", editor->get_inspector_dock(), "_transform_keyed");
}
SpatialEditorPlugin::~SpatialEditorPlugin() {

View File

@ -36,7 +36,8 @@
void ThemeEditor::edit(const Ref<Theme> &p_theme) {
theme = p_theme;
main_vb->set_theme(p_theme);
main_panel->set_theme(p_theme);
main_container->set_theme(p_theme);
}
void ThemeEditor::_propagate_redraw(Control *p_at) {
@ -53,7 +54,8 @@ void ThemeEditor::_propagate_redraw(Control *p_at) {
void ThemeEditor::_refresh_interval() {
_propagate_redraw(main_vb);
_propagate_redraw(main_panel);
_propagate_redraw(main_container);
}
void ThemeEditor::_type_menu_cbk(int p_option) {
@ -130,14 +132,14 @@ void ThemeEditor::_save_template_cbk(String fname) {
Map<String, _TECategory> categories;
//fill types
// Fill types.
List<StringName> type_list;
Theme::get_default()->get_type_list(&type_list);
for (List<StringName>::Element *E = type_list.front(); E; E = E->next()) {
categories.insert(E->get(), _TECategory());
}
//fill default theme
// Fill default theme.
for (Map<String, _TECategory>::Element *E = categories.front(); E; E = E->next()) {
_TECategory &tc = E->get();
@ -256,7 +258,7 @@ void ThemeEditor::_save_template_cbk(String fname) {
file->store_line("");
file->store_line("");
//write default theme
// Write default theme.
for (Map<String, _TECategory>::Element *E = categories.front(); E; E = E->next()) {
_TECategory &tc = E->get();
@ -501,7 +503,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
type_select_label->show();
type_select->show();
if (p_option == POPUP_ADD) { //add
if (p_option == POPUP_ADD) { // Add.
add_del_dialog->set_title(TTR("Add Item"));
add_del_dialog->get_ok()->set_text(TTR("Add"));
@ -509,7 +511,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
base_theme = Theme::get_default();
} else if (p_option == POPUP_CLASS_ADD) { //add
} else if (p_option == POPUP_CLASS_ADD) { // Add.
add_del_dialog->set_title(TTR("Add All Items"));
add_del_dialog->get_ok()->set_text(TTR("Add All"));
@ -552,12 +554,10 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
type_menu->get_popup()->clear();
if (p_option == 0 || p_option == 1) { //add
if (p_option == 0 || p_option == 1) { // Add.
List<StringName> new_types;
theme->get_type_list(&new_types);
//uh kind of sucks
for (List<StringName>::Element *F = new_types.front(); F; F = F->next()) {
bool found = false;
@ -574,7 +574,6 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
}
}
//types.sort();
types.sort_custom<StringName::AlphCompare>();
for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
@ -584,15 +583,17 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
void ThemeEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
time_left -= get_process_delta_time();
if (time_left < 0) {
time_left = 1.5;
_refresh_interval();
}
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
theme_menu->set_icon(get_icon("Theme", "EditorIcons"));
switch (p_what) {
case NOTIFICATION_PROCESS: {
time_left -= get_process_delta_time();
if (time_left < 0) {
time_left = 1.5;
_refresh_interval();
}
} break;
case NOTIFICATION_THEME_CHANGED: {
theme_menu->set_icon(get_icon("Theme", "EditorIcons"));
} break;
}
}
@ -610,30 +611,14 @@ ThemeEditor::ThemeEditor() {
time_left = 0;
scroll = memnew(ScrollContainer);
add_child(scroll);
scroll->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 3);
scroll->set_margin(MARGIN_TOP, 30 * EDSCALE);
//scroll->set_enable_h_scroll(true);
scroll->set_enable_v_scroll(true);
scroll->set_enable_h_scroll(false);
HBoxContainer *top_menu = memnew(HBoxContainer);
add_child(top_menu);
Panel *panel = memnew(Panel);
scroll->add_child(panel);
panel->set_custom_minimum_size(Size2(500, 800) * EDSCALE);
panel->set_theme(Theme::get_default());
panel->set_h_size_flags(SIZE_EXPAND_FILL);
main_vb = memnew(VBoxContainer);
panel->add_child(main_vb);
main_vb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 4 * EDSCALE);
HBoxContainer *hb_menu = memnew(HBoxContainer);
main_vb->add_child(hb_menu);
top_menu->add_child(memnew(Label(TTR("Preview:"))));
top_menu->add_spacer(false);
theme_menu = memnew(MenuButton);
theme_menu->set_text(TTR("Edit theme..."));
theme_menu->set_flat(false);
theme_menu->set_text(TTR("Edit Theme"));
theme_menu->set_tooltip(TTR("Theme editing menu."));
theme_menu->get_popup()->add_item(TTR("Add Item"), POPUP_ADD);
theme_menu->get_popup()->add_item(TTR("Add Class Items"), POPUP_CLASS_ADD);
@ -643,27 +628,59 @@ ThemeEditor::ThemeEditor() {
theme_menu->get_popup()->add_item(TTR("Create Empty Template"), POPUP_CREATE_EMPTY);
theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"), POPUP_CREATE_EDITOR_EMPTY);
theme_menu->get_popup()->add_item(TTR("Create From Current Editor Theme"), POPUP_IMPORT_EDITOR_THEME);
add_child(theme_menu);
theme_menu->set_position(Vector2(3, 3) * EDSCALE);
top_menu->add_child(theme_menu);
theme_menu->get_popup()->connect("id_pressed", this, "_theme_menu_cbk");
ScrollContainer *scroll = memnew(ScrollContainer);
add_child(scroll);
scroll->set_enable_v_scroll(true);
scroll->set_enable_h_scroll(false);
scroll->set_v_size_flags(SIZE_EXPAND_FILL);
MarginContainer *root_container = memnew(MarginContainer);
scroll->add_child(root_container);
root_container->set_theme(Theme::get_default());
root_container->set_clip_contents(true);
root_container->set_custom_minimum_size(Size2(700, 0) * EDSCALE);
root_container->set_v_size_flags(SIZE_EXPAND_FILL);
root_container->set_h_size_flags(SIZE_EXPAND_FILL);
//// Preview Controls ////
main_panel = memnew(Panel);
root_container->add_child(main_panel);
main_container = memnew(MarginContainer);
root_container->add_child(main_container);
main_container->add_constant_override("margin_right", 4 * EDSCALE);
main_container->add_constant_override("margin_top", 4 * EDSCALE);
main_container->add_constant_override("margin_left", 4 * EDSCALE);
main_container->add_constant_override("margin_bottom", 4 * EDSCALE);
HBoxContainer *main_hb = memnew(HBoxContainer);
main_vb->add_child(main_hb);
main_container->add_child(main_hb);
VBoxContainer *first_vb = memnew(VBoxContainer);
first_vb->set_h_size_flags(SIZE_EXPAND_FILL);
main_hb->add_child(first_vb);
//main_panel->add_child(panel);
//panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
//panel->set_margin( MARGIN_TOP,20 );
first_vb->set_h_size_flags(SIZE_EXPAND_FILL);
first_vb->add_constant_override("separation", 10 * EDSCALE);
first_vb->add_child(memnew(Label("Label")));
first_vb->add_child(memnew(Button("Button")));
Button *bt = memnew(Button);
bt->set_text(TTR("Toggle Button"));
bt->set_toggle_mode(true);
bt->set_pressed(true);
first_vb->add_child(bt);
bt = memnew(Button);
bt->set_text(TTR("Disabled Button"));
bt->set_disabled(true);
first_vb->add_child(bt);
ToolButton *tb = memnew(ToolButton);
tb->set_text("ToolButton");
first_vb->add_child(tb);
CheckButton *cb = memnew(CheckButton);
cb->set_text("CheckButton");
first_vb->add_child(cb);
@ -671,31 +688,27 @@ ThemeEditor::ThemeEditor() {
cbx->set_text("CheckBox");
first_vb->add_child(cbx);
VBoxContainer *bg = memnew(VBoxContainer);
bg->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *gbvb = memnew(VBoxContainer);
gbvb->set_v_size_flags(SIZE_EXPAND_FILL);
CheckBox *rbx1 = memnew(CheckBox);
rbx1->set_text(TTR("CheckBox Radio1"));
rbx1->set_pressed(true);
gbvb->add_child(rbx1);
CheckBox *rbx2 = memnew(CheckBox);
rbx2->set_text(TTR("CheckBox Radio2"));
gbvb->add_child(rbx2);
bg->add_child(gbvb);
first_vb->add_child(bg);
MenuButton *test_menu_button = memnew(MenuButton);
test_menu_button->set_text("MenuButton");
test_menu_button->get_popup()->add_item(TTR("Item"));
test_menu_button->get_popup()->add_item(TTR("Disabled Item"));
test_menu_button->get_popup()->set_item_disabled(1, true);
test_menu_button->get_popup()->add_separator();
test_menu_button->get_popup()->add_check_item(TTR("Check Item"));
test_menu_button->get_popup()->add_check_item(TTR("Checked Item"));
test_menu_button->get_popup()->set_item_checked(3, true);
test_menu_button->get_popup()->set_item_checked(4, true);
test_menu_button->get_popup()->add_separator();
test_menu_button->get_popup()->add_radio_check_item(TTR("Radio Item"));
test_menu_button->get_popup()->add_radio_check_item(TTR("Checked Radio Item"));
test_menu_button->get_popup()->set_item_checked(6, true);
test_menu_button->get_popup()->set_item_checked(7, true);
test_menu_button->get_popup()->add_separator(TTR("Named Sep."));
PopupMenu *test_submenu = memnew(PopupMenu);
test_menu_button->get_popup()->add_child(test_submenu);
test_submenu->set_name("submenu");
test_menu_button->get_popup()->add_submenu_item(TTR("Submenu"), "submenu");
test_submenu->add_item(TTR("Subitem 1"));
test_submenu->add_item(TTR("Subitem 2"));
first_vb->add_child(test_menu_button);
OptionButton *test_option_button = memnew(OptionButton);
@ -705,21 +718,7 @@ ThemeEditor::ThemeEditor() {
test_option_button->add_item(TTR("Many"));
test_option_button->add_item(TTR("Options"));
first_vb->add_child(test_option_button);
ColorPickerButton *cpb = memnew(ColorPickerButton);
first_vb->add_child(cpb);
first_vb->add_child(memnew(HSeparator));
first_vb->add_child(memnew(HSlider));
first_vb->add_child(memnew(HScrollBar));
first_vb->add_child(memnew(SpinBox));
ProgressBar *pb = memnew(ProgressBar);
pb->set_value(50);
first_vb->add_child(pb);
Panel *pn = memnew(Panel);
pn->set_custom_minimum_size(Size2(40, 40) * EDSCALE);
first_vb->add_child(pn);
first_vb->add_constant_override("separation", 10 * EDSCALE);
first_vb->add_child(memnew(ColorPickerButton));
VBoxContainer *second_vb = memnew(VBoxContainer);
second_vb->set_h_size_flags(SIZE_EXPAND_FILL);
@ -728,50 +727,48 @@ ThemeEditor::ThemeEditor() {
LineEdit *le = memnew(LineEdit);
le->set_text("LineEdit");
second_vb->add_child(le);
le = memnew(LineEdit);
le->set_text(TTR("Disabled LineEdit"));
le->set_editable(false);
second_vb->add_child(le);
TextEdit *te = memnew(TextEdit);
te->set_text("TextEdit");
//te->set_v_size_flags(SIZE_EXPAND_FILL);
te->set_custom_minimum_size(Size2(0, 160) * EDSCALE);
te->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
second_vb->add_child(te);
second_vb->add_child(memnew(SpinBox));
Tree *test_tree = memnew(Tree);
second_vb->add_child(test_tree);
test_tree->set_custom_minimum_size(Size2(0, 160) * EDSCALE);
TreeItem *item = test_tree->create_item();
item->set_editable(0, true);
item->set_text(0, "Tree");
item = test_tree->create_item(test_tree->get_root());
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_editable(0, true);
item->set_text(0, "Check");
item = test_tree->create_item(test_tree->get_root());
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
item->set_editable(0, true);
item->set_range_config(0, 0, 20, 0.1);
item->set_range(0, 2);
item = test_tree->create_item(test_tree->get_root());
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
item->set_editable(0, true);
item->set_text(0, TTR("Has,Many,Options"));
item->set_range(0, 2);
HBoxContainer *vhb = memnew(HBoxContainer);
second_vb->add_child(vhb);
vhb->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
vhb->add_child(memnew(VSlider));
VScrollBar *vsb = memnew(VScrollBar);
vsb->set_page(25);
vhb->add_child(vsb);
vhb->add_child(memnew(VSeparator));
VBoxContainer *hvb = memnew(VBoxContainer);
vhb->add_child(hvb);
hvb->set_alignment(ALIGN_CENTER);
hvb->set_h_size_flags(SIZE_EXPAND_FILL);
hvb->add_child(memnew(HSlider));
HScrollBar *hsb = memnew(HScrollBar);
hsb->set_page(25);
hvb->add_child(hsb);
HSlider *hs = memnew(HSlider);
hs->set_editable(false);
hvb->add_child(hs);
hvb->add_child(memnew(HSeparator));
ProgressBar *pb = memnew(ProgressBar);
pb->set_value(50);
hvb->add_child(pb);
VBoxContainer *third_vb = memnew(VBoxContainer);
third_vb->set_h_size_flags(SIZE_EXPAND_FILL);
third_vb->add_constant_override("separation", 10);
third_vb->add_constant_override("separation", 10 * EDSCALE);
main_hb->add_child(third_vb);
HBoxContainer *vhb = memnew(HBoxContainer);
vhb->set_custom_minimum_size(Size2(0, 160) * EDSCALE);
vhb->add_child(memnew(VSeparator));
vhb->add_child(memnew(VSlider));
vhb->add_child(memnew(VScrollBar));
third_vb->add_child(vhb);
TabContainer *tc = memnew(TabContainer);
third_vb->add_child(tc);
tc->set_custom_minimum_size(Size2(0, 160) * EDSCALE);
tc->set_custom_minimum_size(Size2(0, 135) * EDSCALE);
Control *tcc = memnew(Control);
tcc->set_name(TTR("Tab 1"));
tc->add_child(tcc);
@ -781,9 +778,41 @@ ThemeEditor::ThemeEditor() {
tcc = memnew(Control);
tcc->set_name(TTR("Tab 3"));
tc->add_child(tcc);
tc->set_tab_disabled(2, true);
Tree *test_tree = memnew(Tree);
third_vb->add_child(test_tree);
test_tree->set_custom_minimum_size(Size2(0, 175) * EDSCALE);
test_tree->add_constant_override("draw_relationship_lines", 1);
TreeItem *item = test_tree->create_item();
item->set_text(0, "Tree");
item = test_tree->create_item(test_tree->get_root());
item->set_text(0, "Item");
item = test_tree->create_item(test_tree->get_root());
item->set_editable(0, true);
item->set_text(0, TTR("Editable Item"));
TreeItem *sub_tree = test_tree->create_item(test_tree->get_root());
sub_tree->set_text(0, TTR("Subtree"));
item = test_tree->create_item(sub_tree);
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_editable(0, true);
item->set_text(0, "Check Item");
item = test_tree->create_item(sub_tree);
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
item->set_editable(0, true);
item->set_range_config(0, 0, 20, 0.1);
item->set_range(0, 2);
item = test_tree->create_item(sub_tree);
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
item->set_editable(0, true);
item->set_text(0, TTR("Has,Many,Options"));
item->set_range(0, 2);
main_hb->add_constant_override("separation", 20 * EDSCALE);
////////
add_del_dialog = memnew(ConfirmationDialog);
add_del_dialog->hide();
add_child(add_del_dialog);
@ -844,9 +873,6 @@ ThemeEditor::ThemeEditor() {
file_dialog->add_filter("*.theme ; Theme File");
add_child(file_dialog);
file_dialog->connect("file_selected", this, "_save_template_cbk");
//MenuButton *name_menu;
//LineEdit *name_edit;
}
void ThemeEditorPlugin::edit(Object *p_node) {
@ -886,7 +912,6 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) {
theme_editor = memnew(ThemeEditor);
theme_editor->set_custom_minimum_size(Size2(0, 200));
//p_node->get_viewport()->add_child(theme_editor);
button = editor->add_bottom_panel_item(TTR("Theme"), theme_editor);
button->hide();
}

View File

@ -33,6 +33,7 @@
#include "scene/gui/check_box.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/option_button.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/texture_rect.h"
@ -40,12 +41,12 @@
#include "editor/editor_node.h"
class ThemeEditor : public Control {
class ThemeEditor : public VBoxContainer {
GDCLASS(ThemeEditor, Control);
GDCLASS(ThemeEditor, VBoxContainer);
ScrollContainer *scroll;
VBoxContainer *main_vb;
Panel *main_panel;
MarginContainer *main_container;
Ref<Theme> theme;
EditorFileDialog *file_dialog;

View File

@ -61,8 +61,8 @@ void TileMapEditor::_notification(int p_what) {
if (is_visible_in_tree()) {
_update_palette();
}
} // fallthrough
FALLTHROUGH;
}
case NOTIFICATION_ENTER_TREE: {

View File

@ -517,7 +517,6 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in
int to = p_to.to_int();
if (!visual_shader->can_connect_nodes(type, from, p_from_index, to, p_to_index)) {
EditorNode::get_singleton()->show_warning(TTR("Unable to connect, port may be in use or connection may be invalid."));
return;
}

View File

@ -631,6 +631,7 @@ void ProjectExportDialog::_delete_preset_confirm() {
int idx = presets->get_current();
_edit_preset(-1);
export_button->set_disabled(true);
EditorExport::get_singleton()->remove_export_preset(idx);
_update_presets();
}

View File

@ -1136,7 +1136,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
break;
}
// else fallthrough to key_down
FALLTHROUGH;
}
case KEY_DOWN: {

View File

@ -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;

View File

@ -261,7 +261,7 @@ void ScriptEditorDebugger::_scene_tree_folded(Object *obj) {
return;
ObjectID id = item->get_metadata(0);
if (item->is_collapsed()) {
if (unfold_cache.has(id)) {
unfold_cache.erase(id);
} else {
unfold_cache.insert(id);

View File

@ -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);

View File

@ -127,6 +127,7 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
case GDScriptParser::OperatorNode::OP_PARENT_CALL:
txt += ".";
FALLTHROUGH;
case GDScriptParser::OperatorNode::OP_CALL: {
ERR_FAIL_COND_V(c_node->arguments.size() < 1, "");

View File

@ -24,10 +24,16 @@ def disable_warnings(self):
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
warn_flags = ['/Wall', '/W4', '/W3', '/W2', '/W1', '/WX']
self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags]
self.Append(CCFLAGS=['/w'])
self.Append(CFLAGS=['/w'])
self.Append(CPPFLAGS=['/w'])
self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags]
self['CFLAGS'] = [x for x in self['CFLAGS'] if not x in warn_flags]
self['CPPFLAGS'] = [x for x in self['CPPFLAGS'] if not x in warn_flags]
else:
self.Append(CCFLAGS=['-w'])
self.Append(CFLAGS=['-w'])
self.Append(CPPFLAGS=['-w'])
def add_module_version_string(self,s):

View File

@ -177,7 +177,7 @@ $GODOT_HEAD_INCLUDE
});
animationCallbacks = animationCallbacks.filter(function(value) {
return (value != animateStatusIndeterminate);
}
});
switch (mode) {
case 'progress':
statusProgress.style.display = 'block';

View File

@ -352,7 +352,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
COPY_PHASE_STRIP = NO;
ENABLE_BITCODE = NO;
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary";
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary/**";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@ -395,7 +395,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";
COPY_PHASE_STRIP = YES;
ENABLE_BITCODE = NO;
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary";
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$binary/**";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

View File

@ -597,6 +597,8 @@ void RigidBodyBullet::set_state(PhysicsServer::BodyState p_state, const Variant
if (!can_sleep) {
// Can't sleep
btBody->forceActivationState(DISABLE_DEACTIVATION);
} else {
btBody->forceActivationState(ACTIVE_TAG);
}
break;
}

View File

@ -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

View File

@ -2491,7 +2491,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
} break;
case GDScriptParser::COMPLETION_FUNCTION: {
is_function = true;
} // fallthrough
FALLTHROUGH;
}
case GDScriptParser::COMPLETION_IDENTIFIER: {
_find_identifiers(context, is_function, options);
} break;
@ -2530,7 +2531,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
} break;
case GDScriptParser::COMPLETION_METHOD: {
is_function = true;
} // fallthrough
FALLTHROUGH;
}
case GDScriptParser::COMPLETION_INDEX: {
const GDScriptParser::Node *node = parser.get_completion_node();
if (node->type != GDScriptParser::Node::TYPE_OPERATOR) {
@ -3006,8 +3008,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: {
@ -3227,7 +3229,8 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
case GDScriptParser::COMPLETION_PARENT_FUNCTION:
case GDScriptParser::COMPLETION_FUNCTION: {
is_function = true;
} // fallthrough
FALLTHROUGH;
}
case GDScriptParser::COMPLETION_IDENTIFIER: {
if (!is_function) {
@ -3358,7 +3361,8 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
} break;
case GDScriptParser::COMPLETION_METHOD: {
is_function = true;
} // fallthrough
FALLTHROUGH;
}
case GDScriptParser::COMPLETION_INDEX: {
const GDScriptParser::Node *node = parser.get_completion_node();
if (node->type != GDScriptParser::Node::TYPE_OPERATOR) {

View File

@ -777,7 +777,8 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
_add_warning(GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, -1, identifier.operator String());
}
} // fallthrough
FALLTHROUGH;
}
case GDScriptTokenizer::TK_OP_ASSIGN: {
lv->assignments += 1;
lv->usages--; // Assignment is not really usage
@ -3636,7 +3637,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
}; //fallthrough to function
FALLTHROUGH;
}
case GDScriptTokenizer::TK_PR_FUNCTION: {
bool _static = false;
@ -4091,7 +4093,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
break;
}
}; //fallthrough to use the same
FALLTHROUGH;
}
case Variant::REAL: {
if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "EASE") {
@ -4516,6 +4519,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
#ifdef DEBUG_ENABLED
_add_warning(GDScriptWarning::DEPRECATED_KEYWORD, tokenizer->get_token_line(), "slave", "puppet");
#endif
FALLTHROUGH;
case GDScriptTokenizer::TK_PR_PUPPET: {
//may be fallthrough from export, ignore if so
@ -4583,7 +4587,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
continue;
} break;
case GDScriptTokenizer::TK_PR_VAR: {
//variale declaration and (eventual) initialization
// variable declaration and (eventual) initialization
ClassNode::Member member;
@ -5323,7 +5327,8 @@ String GDScriptParser::DataType::to_string() const {
if (!gds_class.empty()) {
return gds_class;
}
} // fallthrough
FALLTHROUGH;
}
case SCRIPT: {
if (is_meta_type) {
return script_type->get_class_name().operator String();
@ -8079,7 +8084,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (cn->value.get_type() == Variant::STRING) {
break;
}
} // falthrough
FALLTHROUGH;
}
default: {
_mark_line_as_safe(statement->line);
_reduce_node_type(statement); // Test for safety anyway

View File

@ -745,7 +745,7 @@ void GDScriptTokenizerText::_advance() {
}
INCPOS(1);
is_node_path = true;
FALLTHROUGH;
case '\'':
case '"': {
@ -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;
}

View File

@ -2413,6 +2413,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
r_iarg.default_argument = "null";
break;
}
FALLTHROUGH;
case Variant::DICTIONARY:
case Variant::_RID:
r_iarg.default_argument = "new %s()";

View File

@ -192,9 +192,9 @@ static void _compress_pvrtc4(Image *p_img) {
Ref<Image> img = p_img->duplicate();
bool make_mipmaps = false;
if (img->get_width() % 8 || img->get_height() % 8) {
if (!img->is_size_po2() || img->get_width() != img->get_height()) {
make_mipmaps = img->has_mipmaps();
img->resize(img->get_width() + (8 - (img->get_width() % 8)), img->get_height() + (8 - (img->get_height() % 8)));
img->resize_to_po2(true);
}
img->convert(Image::FORMAT_RGBA8);
if (!img->has_mipmaps() && make_mipmaps)
@ -204,7 +204,7 @@ static void _compress_pvrtc4(Image *p_img) {
Ref<Image> new_img;
new_img.instance();
new_img->create(img->get_width(), img->get_height(), true, use_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4);
new_img->create(img->get_width(), img->get_height(), img->has_mipmaps(), use_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4);
PoolVector<uint8_t> data = new_img->get_data();
{
@ -221,7 +221,6 @@ static void _compress_pvrtc4(Image *p_img) {
/* red and Green colors are swapped. */
new (dp) Javelin::ColorRgba<unsigned char>(r[ofs + 4 * j + 2], r[ofs + 4 * j + 1], r[ofs + 4 * j], r[ofs + 4 * j + 3]);
}
new_img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
Javelin::PvrTcEncoder::EncodeRgba4Bpp(&wr[ofs], bm);
}

View File

@ -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() {

View File

@ -148,9 +148,11 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
uint8_t a = 0xff;
if (p_header.color_map_depth == 24) {
r = (p_palette[(index * 3) + 0]);
// Due to low-high byte order, the color table must be
// read in the same order as image data (little endian)
r = (p_palette[(index * 3) + 2]);
g = (p_palette[(index * 3) + 1]);
b = (p_palette[(index * 3) + 2]);
b = (p_palette[(index * 3) + 0]);
} else {
return ERR_INVALID_DATA;
}

View File

@ -1923,10 +1923,6 @@ public:
zipClose(final_apk, NULL);
unzClose(tmp_unaligned);
if (err) {
return err;
}
return OK;
}

View File

@ -135,3 +135,6 @@ def configure(env):
# TODO: Reevaluate usage of this setting now that engine.js manages engine runtime.
env.Append(LINKFLAGS=['-s', 'NO_EXIT_RUNTIME=1'])
#adding flag due to issue with emscripten 1.38.41 callMain method https://github.com/emscripten-core/emscripten/blob/incoming/ChangeLog.md#v13841-08072019
env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS=["callMain"]'])

View File

@ -328,7 +328,7 @@ def configure_mingw(env):
env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
env.Append(CCFLAGS=['-DWINMIDI_ENABLED'])
env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']])
env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt','avrt'])
env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt', 'avrt', 'uuid'])
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])

View File

@ -53,6 +53,7 @@
#include <avrt.h>
#include <direct.h>
#include <knownfolders.h>
#include <process.h>
#include <regstr.h>
#include <shlobj.h>
@ -827,8 +828,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (wParam==VK_WIN) TODO wtf is this?
meta_mem=uMsg==WM_KEYDOWN;
*/
} //fallthrough
FALLTHROUGH;
}
case WM_CHAR: {
ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);
@ -2867,39 +2868,41 @@ String OS_Windows::get_godot_dir_name() const {
String OS_Windows::get_system_dir(SystemDir p_dir) const {
int id;
KNOWNFOLDERID id;
switch (p_dir) {
case SYSTEM_DIR_DESKTOP: {
id = CSIDL_DESKTOPDIRECTORY;
id = FOLDERID_Desktop;
} break;
case SYSTEM_DIR_DCIM: {
id = CSIDL_MYPICTURES;
id = FOLDERID_Pictures;
} break;
case SYSTEM_DIR_DOCUMENTS: {
id = CSIDL_PERSONAL;
id = FOLDERID_Documents;
} break;
case SYSTEM_DIR_DOWNLOADS: {
id = 0x000C;
id = FOLDERID_Downloads;
} break;
case SYSTEM_DIR_MOVIES: {
id = CSIDL_MYVIDEO;
id = FOLDERID_Videos;
} break;
case SYSTEM_DIR_MUSIC: {
id = CSIDL_MYMUSIC;
id = FOLDERID_Music;
} break;
case SYSTEM_DIR_PICTURES: {
id = CSIDL_MYPICTURES;
id = FOLDERID_Pictures;
} break;
case SYSTEM_DIR_RINGTONES: {
id = CSIDL_MYMUSIC;
id = FOLDERID_Music;
} break;
}
WCHAR szPath[MAX_PATH];
HRESULT res = SHGetFolderPathW(NULL, id, NULL, 0, szPath);
PWSTR szPath;
HRESULT res = SHGetKnownFolderPath(id, 0, NULL, &szPath);
ERR_FAIL_COND_V(res != S_OK, String());
return String(szPath);
String path = String(szPath);
CoTaskMemFree(szPath);
return path;
}
String OS_Windows::get_user_data_dir() const {

View File

@ -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

View File

@ -645,6 +645,9 @@ void AnimatedSprite::_reset_timeout() {
void AnimatedSprite::set_animation(const StringName &p_animation) {
ERR_EXPLAIN(vformat("There is no animation with name '%s'.", p_animation));
ERR_FAIL_COND(frames->get_animation_names().find(p_animation) == -1);
if (animation == p_animation)
return;

View File

@ -29,6 +29,7 @@
/*************************************************************************/
#include "collision_object_2d.h"
#include "scene/scene_string_names.h"
#include "servers/physics_2d_server.h"
@ -56,7 +57,7 @@ void CollisionObject2D::_notification(int p_what) {
_update_pickable();
//get space
}
} break;
case NOTIFICATION_ENTER_CANVAS: {
@ -64,7 +65,7 @@ void CollisionObject2D::_notification(int p_what) {
Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, get_canvas_layer_instance_id());
else
Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, get_canvas_layer_instance_id());
}
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@ -101,7 +102,7 @@ void CollisionObject2D::_notification(int p_what) {
Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, 0);
else
Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, 0);
}
} break;
}
}

View File

@ -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;

View File

@ -52,7 +52,7 @@ void CollisionObject::_notification(int p_what) {
_update_pickable();
//get space
};
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {

View File

@ -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;

View File

@ -891,7 +891,7 @@ void AnimationTree::_process_graph(float p_delta) {
t->loc = Vector3();
t->rot = Quat();
t->rot_blend_accum = 0;
t->scale = Vector3();
t->scale = Vector3(1, 1, 1);
}
float prev_time = time - delta;
@ -952,11 +952,9 @@ void AnimationTree::_process_graph(float p_delta) {
t->loc = loc;
t->rot = rot;
t->rot_blend_accum = 0;
t->scale = Vector3();
t->scale = scale;
}
scale -= Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes
if (err != OK)
continue;
@ -1241,8 +1239,6 @@ void AnimationTree::_process_graph(float p_delta) {
Transform xform;
xform.origin = t->loc;
t->scale += Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes and root motion
xform.basis.set_quat_scale(t->rot, t->scale);
if (t->root_motion) {
@ -1276,7 +1272,8 @@ void AnimationTree::_process_graph(float p_delta) {
t->object->set_indexed(t->subpath, t->value);
} break;
default: {} //the rest don't matter
default: {
} //the rest don't matter
}
}
}

View File

@ -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)

View File

@ -29,6 +29,7 @@
/*************************************************************************/
#include "button.h"
#include "core/translation.h"
#include "servers/visual_server.h"
@ -102,6 +103,7 @@ void Button::_notification(int p_what) {
break;
}
FALLTHROUGH;
}
case DRAW_PRESSED: {

View File

@ -29,6 +29,7 @@
/*************************************************************************/
#include "line_edit.h"
#include "core/message_queue.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
@ -43,7 +44,7 @@
static bool _is_text_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
return !is_symbol(c);
}
void LineEdit::_gui_input(Ref<InputEvent> p_event) {
@ -320,7 +321,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
handled = false;
break;
}
// numlock disabled. fallthrough to key_left
FALLTHROUGH;
}
case KEY_LEFT: {
@ -367,7 +368,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
handled = false;
break;
}
// numlock disabled. fallthrough to key_right
FALLTHROUGH;
}
case KEY_RIGHT: {
@ -474,7 +475,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
handled = false;
break;
}
// numlock disabled. fallthrough to key_home
FALLTHROUGH;
}
case KEY_HOME: {
@ -487,7 +488,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
handled = false;
break;
}
// numlock disabled. fallthrough to key_end
FALLTHROUGH;
}
case KEY_END: {
@ -721,6 +722,8 @@ void LineEdit::_notification(int p_what) {
} else {
x_ofs = MAX(style->get_margin(MARGIN_LEFT), x_ofs - r_icon->get_width() - style->get_margin(MARGIN_RIGHT));
}
ofs_max -= r_icon->get_width();
}
int caret_height = font->get_height() > y_area ? y_area : font->get_height();
@ -917,6 +920,10 @@ void LineEdit::undo() {
TextOperation op = undo_stack_pos->get();
text = op.text;
set_cursor_position(op.cursor_pos);
if (expand_to_text_length)
minimum_size_changed();
_emit_text_change();
}
@ -931,6 +938,10 @@ void LineEdit::redo() {
TextOperation op = undo_stack_pos->get();
text = op.text;
set_cursor_position(op.cursor_pos);
if (expand_to_text_length)
minimum_size_changed();
_emit_text_change();
}
@ -1158,8 +1169,10 @@ void LineEdit::set_cursor_position(int p_pos) {
} else if (cursor_pos > window_pos) {
/* Adjust window if cursor goes too much to the right */
int window_width = get_size().width - style->get_minimum_size().width;
if (right_icon.is_valid()) {
window_width -= right_icon->get_width();
bool display_clear_icon = !text.empty() && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
Ref<Texture> r_icon = display_clear_icon ? Control::get_icon("clear") : right_icon;
window_width -= r_icon->get_width();
}
if (window_width < 0)

View File

@ -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) {

View File

@ -60,7 +60,7 @@ void ProgressBar::_notification(int p_what) {
draw_style_box(bg, Rect2(Point2(), get_size()));
float r = get_as_ratio();
int mp = fg->get_minimum_size().width;
int p = r * get_size().width - mp;
int p = r * (get_size().width - mp);
if (p > 0) {
draw_style_box(fg, Rect2(Point2(), Size2(p + fg->get_minimum_size().width, get_size().height)));

View File

@ -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;
}

View File

@ -50,7 +50,7 @@ inline bool _is_symbol(CharType c) {
static bool _is_text_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
return !is_symbol(c);
}
static bool _is_whitespace(CharType c) {
@ -2517,7 +2517,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_left
FALLTHROUGH;
}
case KEY_LEFT: {
@ -2580,7 +2580,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_right
FALLTHROUGH;
}
case KEY_RIGHT: {
@ -2641,7 +2641,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_up
FALLTHROUGH;
}
case KEY_UP: {
@ -2694,7 +2694,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_down
FALLTHROUGH;
}
case KEY_DOWN: {
@ -2817,11 +2817,10 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_home
FALLTHROUGH;
}
#ifdef APPLE_STYLE_KEYS
case KEY_HOME: {
#ifdef APPLE_STYLE_KEYS
if (k->get_shift())
_pre_shift_selection();
@ -2831,11 +2830,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_post_shift_selection();
else if (k->get_command() || k->get_control())
deselect();
} break;
#else
case KEY_HOME: {
if (k->get_shift())
_pre_shift_selection();
@ -2876,19 +2871,17 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
deselect();
_cancel_completion();
completion_hint = "";
} break;
#endif
} break;
case KEY_KP_1: {
if (k->get_unicode() != 0) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_end
FALLTHROUGH;
}
#ifdef APPLE_STYLE_KEYS
case KEY_END: {
#ifdef APPLE_STYLE_KEYS
if (k->get_shift())
_pre_shift_selection();
@ -2898,11 +2891,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_post_shift_selection();
else if (k->get_command() || k->get_control())
deselect();
} break;
#else
case KEY_END: {
if (k->get_shift())
_pre_shift_selection();
@ -2929,15 +2918,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_cancel_completion();
completion_hint = "";
} break;
#endif
} break;
case KEY_KP_9: {
if (k->get_unicode() != 0) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_pageup
FALLTHROUGH;
}
case KEY_PAGEUP: {
@ -2960,7 +2948,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
// numlock disabled. fallthrough to key_pagedown
FALLTHROUGH;
}
case KEY_PAGEDOWN: {
@ -3139,21 +3127,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (scancode_handled)
accept_event();
/*
if (!scancode_handled && !k->get_command() && !k->get_alt()) {
if (k->get_unicode()>=32) {
if (readonly)
break;
accept_event();
} else {
break;
}
}
*/
if (k->get_scancode() == KEY_INSERT) {
set_insert_mode(!insert_mode);
accept_event();
@ -3196,7 +3170,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
end_complex_operation();
}
accept_event();
} else {
}
}

View File

@ -29,7 +29,6 @@
/*************************************************************************/
#include "tree.h"
#include <limits.h>
#include "core/math/math_funcs.h"
#include "core/os/input.h"
@ -43,6 +42,8 @@
#include "editor/editor_node.h"
#endif
#include <limits.h>
void TreeItem::move_to_top() {
if (!parent || parent->children == this)
@ -940,6 +941,7 @@ int Tree::compute_item_height(TreeItem *p_item) const {
int check_icon_h = cache.checked->get_height();
if (height < check_icon_h)
height = check_icon_h;
FALLTHROUGH;
}
case TreeItem::CELL_MODE_STRING:
case TreeItem::CELL_MODE_CUSTOM:
@ -3930,7 +3932,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;

View File

@ -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;

View File

@ -369,8 +369,7 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group
}
void SceneTree::call_group(const StringName &p_group, const StringName &p_function, VARIANT_ARG_DECLARE) {
call_group_flags(0, p_group, VARIANT_ARG_PASS);
call_group_flags(0, p_group, p_function, VARIANT_ARG_PASS);
}
void SceneTree::notify_group(const StringName &p_group, int p_notification) {

View File

@ -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;
}

View File

@ -184,7 +184,8 @@ void ParticlesMaterial::_update_shader() {
} break;
case EMISSION_SHAPE_DIRECTED_POINTS: {
code += "uniform sampler2D emission_texture_normal : hint_black;\n";
} //fallthrough
FALLTHROUGH;
}
case EMISSION_SHAPE_POINTS: {
code += "uniform sampler2D emission_texture_points : hint_black;\n";
code += "uniform int emission_texture_point_count;\n";

View File

@ -240,6 +240,9 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po
if (!g->nodes.has(p_from_node))
return false;
if (p_from_node == p_to_node)
return false;
if (p_from_port < 0 || p_from_port >= g->nodes[p_from_node].node->get_output_port_count())
return false;

View File

@ -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;

View File

@ -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;
}

View File

@ -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++) {

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -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);

View File

@ -29,6 +29,10 @@
#define JPGD_MAX(a,b) (((a)>(b)) ? (a) : (b))
#define JPGD_MIN(a,b) (((a)<(b)) ? (a) : (b))
// TODO: Move to header and use these constants when declaring the arrays.
#define JPGD_HUFF_TREE_MAX_LENGTH 512
#define JPGD_HUFF_CODE_SIZE_MAX_LENGTH 256
namespace jpgd {
static inline void *jpgd_malloc(size_t nSize) { return malloc(nSize); }
@ -491,8 +495,9 @@ inline uint jpeg_decoder::get_bits_no_markers(int num_bits)
// Decodes a Huffman encoded symbol.
inline int jpeg_decoder::huff_decode(huff_tables *pH)
{
int symbol;
JPGD_ASSERT(pH);
int symbol;
// Check first 8-bits: do we have a complete symbol?
if ((symbol = pH->look_up[m_bit_buf >> 24]) < 0)
{
@ -500,14 +505,19 @@ inline int jpeg_decoder::huff_decode(huff_tables *pH)
int ofs = 23;
do
{
symbol = pH->tree[-(int)(symbol + ((m_bit_buf >> ofs) & 1))];
unsigned int idx = -(int)(symbol + ((m_bit_buf >> ofs) & 1));
JPGD_ASSERT(idx < JPGD_HUFF_TREE_MAX_LENGTH);
symbol = pH->tree[idx];
ofs--;
} while (symbol < 0);
get_bits_no_markers(8 + (23 - ofs));
}
else
{
JPGD_ASSERT(symbol < JPGD_HUFF_CODE_SIZE_MAX_LENGTH);
get_bits_no_markers(pH->code_size[symbol]);
}
return symbol;
}
@ -517,6 +527,8 @@ inline int jpeg_decoder::huff_decode(huff_tables *pH, int& extra_bits)
{
int symbol;
JPGD_ASSERT(pH);
// Check first 8-bits: do we have a complete symbol?
if ((symbol = pH->look_up2[m_bit_buf >> 24]) < 0)
{
@ -524,7 +536,9 @@ inline int jpeg_decoder::huff_decode(huff_tables *pH, int& extra_bits)
int ofs = 23;
do
{
symbol = pH->tree[-(int)(symbol + ((m_bit_buf >> ofs) & 1))];
unsigned int idx = -(int)(symbol + ((m_bit_buf >> ofs) & 1));
JPGD_ASSERT(idx < JPGD_HUFF_TREE_MAX_LENGTH);
symbol = pH->tree[idx];
ofs--;
} while (symbol < 0);
@ -1495,6 +1509,12 @@ void jpeg_decoder::fix_in_buffer()
void jpeg_decoder::transform_mcu(int mcu_row)
{
jpgd_block_t* pSrc_ptr = m_pMCU_coefficients;
if (m_freq_domain_chroma_upsample) {
JPGD_ASSERT(mcu_row * m_blocks_per_mcu < m_expanded_blocks_per_row);
}
else {
JPGD_ASSERT(mcu_row * m_blocks_per_mcu < m_max_blocks_per_row);
}
uint8* pDst_ptr = m_pSample_buf + mcu_row * m_blocks_per_mcu * 64;
for (int mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++)
@ -1650,6 +1670,7 @@ void jpeg_decoder::load_next_row()
for (mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++)
{
component_id = m_mcu_org[mcu_block];
JPGD_ASSERT(m_comp_quant[component_id] < JPGD_MAX_QUANT_TABLES);
q = m_quant[m_comp_quant[component_id]];
p = m_pMCU_coefficients + 64 * mcu_block;
@ -1770,6 +1791,7 @@ void jpeg_decoder::decode_next_row()
for (int mcu_block = 0; mcu_block < m_blocks_per_mcu; mcu_block++, p += 64)
{
int component_id = m_mcu_org[mcu_block];
JPGD_ASSERT(m_comp_quant[component_id] < JPGD_MAX_QUANT_TABLES);
jpgd_quant_t* q = m_quant[m_comp_quant[component_id]];
int r, s;
@ -2229,7 +2251,10 @@ void jpeg_decoder::make_huff_table(int index, huff_tables *pH)
for (l = 1; l <= 16; l++)
{
for (i = 1; i <= m_huff_num[index][l]; i++)
{
JPGD_ASSERT(p < 257);
huffsize[p++] = static_cast<uint8>(l);
}
}
huffsize[p] = 0;
@ -2244,6 +2269,7 @@ void jpeg_decoder::make_huff_table(int index, huff_tables *pH)
{
while (huffsize[p] == si)
{
JPGD_ASSERT(p < 257);
huffcode[p++] = code;
code++;
}
@ -2275,7 +2301,8 @@ void jpeg_decoder::make_huff_table(int index, huff_tables *pH)
for (l = 1 << (8 - code_size); l > 0; l--)
{
JPGD_ASSERT(i < 256);
JPGD_ASSERT(i < JPGD_HUFF_CODE_SIZE_MAX_LENGTH);
JPGD_ASSERT(code < JPGD_HUFF_CODE_SIZE_MAX_LENGTH);
pH->look_up[code] = i;
@ -2325,16 +2352,19 @@ void jpeg_decoder::make_huff_table(int index, huff_tables *pH)
if ((code & 0x8000) == 0)
currententry--;
if (pH->tree[-currententry - 1] == 0)
unsigned int idx = -currententry - 1;
JPGD_ASSERT(idx < JPGD_HUFF_TREE_MAX_LENGTH);
if (pH->tree[idx] == 0)
{
pH->tree[-currententry - 1] = nextfreeentry;
pH->tree[idx] = nextfreeentry;
currententry = nextfreeentry;
nextfreeentry -= 2;
}
else
currententry = pH->tree[-currententry - 1];
else {
currententry = pH->tree[idx];
}
code <<= 1;
}
@ -2636,7 +2666,9 @@ void jpeg_decoder::decode_block_ac_first(jpeg_decoder *pD, int component_id, int
for (k = pD->m_spectral_start; k <= pD->m_spectral_end; k++)
{
s = pD->huff_decode(pD->m_pHuff_tabs[pD->m_comp_ac_tab[component_id]]);
unsigned int idx = pD->m_comp_ac_tab[component_id];
JPGD_ASSERT(idx < JPGD_MAX_HUFF_TABLES);
s = pD->huff_decode(pD->m_pHuff_tabs[idx]);
r = s >> 4;
s &= 15;
@ -2679,7 +2711,6 @@ void jpeg_decoder::decode_block_ac_refine(jpeg_decoder *pD, int component_id, in
int p1 = 1 << pD->m_successive_low;
int m1 = (-1) << pD->m_successive_low;
jpgd_block_t *p = pD->coeff_buf_getp(pD->m_ac_coeffs[component_id], block_x, block_y);
JPGD_ASSERT(pD->m_spectral_end <= 63);
k = pD->m_spectral_start;
@ -2688,7 +2719,9 @@ void jpeg_decoder::decode_block_ac_refine(jpeg_decoder *pD, int component_id, in
{
for ( ; k <= pD->m_spectral_end; k++)
{
s = pD->huff_decode(pD->m_pHuff_tabs[pD->m_comp_ac_tab[component_id]]);
unsigned int idx = pD->m_comp_ac_tab[component_id];
JPGD_ASSERT(idx < JPGD_MAX_HUFF_TABLES);
s = pD->huff_decode(pD->m_pHuff_tabs[idx]);
r = s >> 4;
s &= 15;