Merge pull request #59648 from akien-mga/3.x-cherrypicks

This commit is contained in:
Rémi Verschelde 2022-03-29 01:19:44 +02:00 committed by GitHub
commit 91c6192678
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 177 additions and 68 deletions

View file

@ -145,6 +145,10 @@ struct DirAccessRef {
operator bool() const { return f != nullptr; }
DirAccess *f;
DirAccessRef(DirAccess *fa) { f = fa; }
DirAccessRef(DirAccessRef &&other) {
f = other.f;
other.f = nullptr;
}
~DirAccessRef() {
if (f) {
memdelete(f);

View file

@ -186,6 +186,10 @@ struct FileAccessRef {
FileAccess *f;
operator FileAccess *() { return f; }
FileAccessRef(FileAccess *fa) { f = fa; }
FileAccessRef(FileAccessRef &&other) {
f = other.f;
other.f = nullptr;
}
~FileAccessRef() {
if (f) {
memdelete(f);

View file

@ -1418,7 +1418,8 @@
Hints that a float property should be within an exponential range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"0.01,100,0.01,or_greater"[/code].
</constant>
<constant name="PROPERTY_HINT_ENUM" value="3" enum="PropertyHint">
Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code].
Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string.
The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. For integer and float properties, the first name in the list has value 0, the next 1, and so on. Explicit values can also be specified by appending [code]:integer[/code] to the name, e.g. [code]"Zero,One,Three:3,Four,Six:6"[/code].
</constant>
<constant name="PROPERTY_HINT_ENUM_SUGGESTION" value="37" enum="PropertyHint">
Hints that a string property can be an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code].

View file

@ -4,7 +4,8 @@
[AnimationTree] node resource that contains many blend type nodes.
</brief_description>
<description>
This node may contain a sub-tree of any other blend type nodes, such as mix, blend2, blend3, one shot, etc. This is one of the most commonly used roots.
This node may contain a sub-tree of any other blend type nodes, such as [AnimationNodeTransition], [AnimationNodeBlend2], [AnimationNodeBlend3], [AnimationNodeOneShot], etc. This is one of the most commonly used roots.
An [AnimationNodeOutput] node named [code]output[/code] is created by default.
</description>
<tutorials>
<link>$DOCS_URL/tutorials/animation/animation_tree.html</link>

View file

@ -688,8 +688,8 @@
var some_string = "One,Two,Three,Four"
var some_array = some_string.rsplit(",", true, 1)
print(some_array.size()) # Prints 2
print(some_array[0]) # Prints "Four"
print(some_array[1]) # Prints "Three,Two,One"
print(some_array[0]) # Prints "One,Two,Three"
print(some_array[1]) # Prints "Four"
[/codeblock]
</description>
</method>

View file

@ -1548,8 +1548,9 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &
}
void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), ""));
String ext_filter = (get_os_name() == "Windows") ? "*.exe" : "";
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, ext_filter), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, ext_filter), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false));
@ -1682,8 +1683,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
}
if (err == OK && !so_files.empty()) {
//if shared object files, copy them
da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
// If shared object files, copy them.
for (int i = 0; i < so_files.size() && err == OK; i++) {
err = da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file()));
if (err == OK) {

View file

@ -1199,6 +1199,18 @@ void EditorFileDialog::_update_favorites() {
favorite->set_pressed(false);
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
bool fav_changed = false;
for (int i = favorited.size() - 1; i >= 0; i--) {
if (!dir_access->dir_exists(favorited[i])) {
favorited.remove(i);
fav_changed = true;
}
}
if (fav_changed) {
EditorSettings::get_singleton()->set_favorites(favorited);
}
for (int i = 0; i < favorited.size(); i++) {
bool cres = favorited[i].begins_with("res://");
if (cres != res) {

View file

@ -1612,8 +1612,22 @@ void EditorInspector::update_tree() {
current_vbox->add_child(section);
sections.push_back(section);
const String label = EditorPropertyNameProcessor::get_singleton()->process_name(path_name, property_name_style);
const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(path_name, EditorPropertyNameProcessor::get_tooltip_style(property_name_style));
String label;
String tooltip;
// Only process group label if this is not the group or subgroup.
if ((i == 0 && path_name == group)) {
if (property_name_style == EditorPropertyNameProcessor::STYLE_LOCALIZED) {
label = TTRGET(path_name);
tooltip = path_name;
} else {
label = path_name;
tooltip = TTRGET(path_name);
}
} else {
label = EditorPropertyNameProcessor::get_singleton()->process_name(path_name, property_name_style);
tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(path_name, EditorPropertyNameProcessor::get_tooltip_style(property_name_style));
}
Color c = sscolor;
c.a /= level;

View file

@ -1703,6 +1703,7 @@ void EditorNode::_dialog_action(String p_file) {
case FILE_CLOSE:
case FILE_CLOSE_ALL_AND_QUIT:
case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
case FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT:
case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE:
case FILE_SAVE_AS_SCENE: {
@ -2354,17 +2355,23 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_CLOSE_ALL_AND_QUIT:
case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
case FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT:
case FILE_CLOSE: {
if (!p_confirmed) {
tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false);
_scene_tab_changed(tab_closing);
if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER || p_option == FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT) {
Node *scene_root = editor_data.get_edited_scene_root(tab_closing);
if (scene_root) {
String scene_filename = scene_root->get_filename();
if (p_option == FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT) {
save_confirmation->get_ok()->set_text(TTR("Save & Reload"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before reloading?"), scene_filename != "" ? scene_filename : "unsaved scene"));
} else {
save_confirmation->get_ok()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
}
save_confirmation->popup_centered_minsize();
break;
}
@ -2698,11 +2705,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_EXPLORE_ANDROID_BUILD_TEMPLATES: {
OS::get_singleton()->shell_open("file://" + ProjectSettings::get_singleton()->get_resource_path().plus_file("android"));
} break;
case RUN_RELOAD_CURRENT_PROJECT: {
restart_editor();
} break;
case FILE_QUIT:
case RUN_PROJECT_MANAGER: {
case RUN_PROJECT_MANAGER:
case RELOAD_CURRENT_PROJECT: {
if (!p_confirmed) {
bool save_each = EDITOR_GET("interface/editor/save_each_scene_on_quit");
if (_next_unsaved_scene(!save_each) == -1) {
@ -2717,7 +2722,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
} else {
if (save_each) {
_menu_option_confirm(p_option == FILE_QUIT ? FILE_CLOSE_ALL_AND_QUIT : FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, false);
if (p_option == RELOAD_CURRENT_PROJECT) {
_menu_option_confirm(FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT, false);
} else if (p_option == FILE_QUIT) {
_menu_option_confirm(FILE_CLOSE_ALL_AND_QUIT, false);
} else {
_menu_option_confirm(FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, false);
}
} else {
String unsaved_scenes;
int i = _next_unsaved_scene(true, 0);
@ -2725,9 +2736,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
unsaved_scenes += "\n " + editor_data.get_edited_scene_root(i)->get_filename();
i = _next_unsaved_scene(true, ++i);
}
if (p_option == RELOAD_CURRENT_PROJECT) {
save_confirmation->get_ok()->set_text(TTR("Save & Reload"));
save_confirmation->set_text(TTR("Save changes to the following scene(s) before reloading?") + unsaved_scenes);
} else {
save_confirmation->get_ok()->set_text(TTR("Save & Quit"));
save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes to the following scene(s) before opening Project Manager?")) + unsaved_scenes);
}
save_confirmation->popup_centered_minsize();
}
}
@ -2982,6 +2997,7 @@ void EditorNode::_discard_changes(const String &p_str) {
switch (current_option) {
case FILE_CLOSE_ALL_AND_QUIT:
case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
case FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT:
case FILE_CLOSE:
case FILE_CLOSE_OTHERS:
case FILE_CLOSE_RIGHT:
@ -2998,13 +3014,19 @@ void EditorNode::_discard_changes(const String &p_str) {
_remove_scene(tab_closing);
_update_scene_tabs();
if (current_option == FILE_CLOSE_ALL_AND_QUIT || current_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
if (current_option == FILE_CLOSE_ALL_AND_QUIT || current_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER || current_option == FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT) {
// If restore tabs is enabled, reopen the scene that has just been closed, so it's remembered properly.
if (bool(EDITOR_GET("interface/scene_tabs/restore_scenes_on_load"))) {
_menu_option_confirm(FILE_OPEN_PREV, true);
}
if (_next_unsaved_scene(false) == -1) {
current_option = current_option == FILE_CLOSE_ALL_AND_QUIT ? FILE_QUIT : RUN_PROJECT_MANAGER;
if (current_option == FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT) {
current_option = RELOAD_CURRENT_PROJECT;
} else if (current_option == FILE_CLOSE_ALL_AND_QUIT) {
current_option = FILE_QUIT;
} else {
current_option = RUN_PROJECT_MANAGER;
}
_discard_changes();
} else {
_menu_option_confirm(current_option, false);
@ -3042,6 +3064,9 @@ void EditorNode::_discard_changes(const String &p_str) {
Error err = OS::get_singleton()->execute(exec, args, false, &pid);
ERR_FAIL_COND(err);
} break;
case RELOAD_CURRENT_PROJECT: {
restart_editor();
} break;
}
}
@ -6397,7 +6422,7 @@ EditorNode::EditorNode() {
tool_menu->add_item(TTR("Orphan Resource Explorer..."), TOOLS_ORPHAN_RESOURCES);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RUN_RELOAD_CURRENT_PROJECT);
p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RELOAD_CURRENT_PROJECT);
#ifdef OSX_ENABLED
p->add_shortcut(ED_SHORTCUT("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q), RUN_PROJECT_MANAGER, true);
#else

View file

@ -146,6 +146,7 @@ private:
FILE_CLOSE_ALL,
FILE_CLOSE_ALL_AND_QUIT,
FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER,
FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT,
FILE_QUIT,
FILE_EXTERNAL_OPEN_SCENE,
EDIT_UNDO,
@ -164,7 +165,7 @@ private:
RUN_SCENE_SETTINGS,
RUN_SETTINGS,
RUN_USER_DATA_FOLDER,
RUN_RELOAD_CURRENT_PROJECT,
RELOAD_CURRENT_PROJECT,
RUN_PROJECT_MANAGER,
RUN_FILE_SERVER,
RUN_LIVE_DEBUG,

View file

@ -219,6 +219,19 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
bool fav_changed = false;
for (int i = favorite_paths.size() - 1; i >= 0; i--) {
if (!da->dir_exists(favorite_paths[i])) {
favorite_paths.remove(i);
fav_changed = true;
}
}
if (fav_changed) {
EditorSettings::get_singleton()->set_favorites(favorite_paths);
}
for (int i = 0; i < favorite_paths.size(); i++) {
String fave = favorite_paths[i];
if (!fave.begins_with("res://")) {

View file

@ -159,6 +159,11 @@ bool ResourceImporterTexture::get_option_visibility(const String &p_option, cons
if (compress_mode != COMPRESS_VIDEO_RAM) {
return false;
}
} else if (p_option == "compress/normal_map") {
int compress_mode = int(p_options["compress/mode"]);
if (compress_mode == COMPRESS_LOSSLESS) {
return false;
}
} else if (p_option == "compress/bptc_ldr") {
int compress_mode = int(p_options["compress/mode"]);
if (compress_mode != COMPRESS_VIDEO_RAM) {

View file

@ -61,6 +61,11 @@ bool ResourceImporterWAV::get_option_visibility(const String &p_option, const Ma
return false;
}
// Don't show begin/end loop points if loop mode is auto-detected or disabled.
if ((int)p_options["edit/loop_mode"] < 2 && (p_option == "edit/loop_begin" || p_option == "edit/loop_end")) {
return false;
}
return true;
}
@ -78,7 +83,10 @@ void ResourceImporterWAV::get_import_options(List<ImportOption> *r_options, int
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "force/max_rate_hz", PROPERTY_HINT_EXP_RANGE, "11025,192000,1"), 44100));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/trim"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/normalize"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/loop"), false));
// Keep the `edit/loop_mode` enum in sync with AudioStreamSample::LoopMode (note: +1 offset due to "Detect From WAV").
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_mode", PROPERTY_HINT_ENUM, "Detect From WAV,Disabled,Forward,Ping-Pong,Backward", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_begin"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_end"), -1));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "Disabled,RAM (Ima-ADPCM)"), 0));
}
@ -116,10 +124,14 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Not a WAV file (no WAVE RIFF header).");
}
// Let users override potential loop points from the WAV.
// We parse the WAV loop points only with "Detect From WAV" (0).
int import_loop_mode = p_options["edit/loop_mode"];
int format_bits = 0;
int format_channels = 0;
AudioStreamSample::LoopMode loop = AudioStreamSample::LOOP_DISABLED;
AudioStreamSample::LoopMode loop_mode = AudioStreamSample::LOOP_DISABLED;
uint16_t compression_code = 1;
bool format_found = false;
bool data_found = false;
@ -245,8 +257,8 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
if (chunkID[0] == 's' && chunkID[1] == 'm' && chunkID[2] == 'p' && chunkID[3] == 'l') {
//loop point info!
if (import_loop_mode == 0 && chunkID[0] == 's' && chunkID[1] == 'm' && chunkID[2] == 'p' && chunkID[3] == 'l') {
// Loop point info!
/**
* Consider exploring next document:
@ -267,11 +279,11 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
int loop_type = file->get_32();
if (loop_type == 0x00 || loop_type == 0x01 || loop_type == 0x02) {
if (loop_type == 0x00) {
loop = AudioStreamSample::LOOP_FORWARD;
loop_mode = AudioStreamSample::LOOP_FORWARD;
} else if (loop_type == 0x01) {
loop = AudioStreamSample::LOOP_PING_PONG;
loop_mode = AudioStreamSample::LOOP_PING_PONG;
} else if (loop_type == 0x02) {
loop = AudioStreamSample::LOOP_BACKWARD;
loop_mode = AudioStreamSample::LOOP_BACKWARD;
}
loop_begin = file->get_32();
loop_end = file->get_32();
@ -343,7 +355,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
if (loop) {
if (loop_mode) {
loop_begin = (int)(loop_begin * (float)new_data_frames / (float)frames);
loop_end = (int)(loop_end * (float)new_data_frames / (float)frames);
}
@ -374,7 +386,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
bool trim = p_options["edit/trim"];
if (trim && !loop && format_channels > 0) {
if (trim && (loop_mode != AudioStreamSample::LOOP_DISABLED) && format_channels > 0) {
int first = 0;
int last = (frames / format_channels) - 1;
bool found = false;
@ -418,12 +430,17 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
bool make_loop = p_options["edit/loop"];
if (make_loop && !loop) {
loop = AudioStreamSample::LOOP_FORWARD;
loop_begin = 0;
loop_end = frames;
if (import_loop_mode >= 2) {
loop_mode = (AudioStreamSample::LoopMode)(import_loop_mode - 1);
loop_begin = p_options["edit/loop_begin"];
loop_end = p_options["edit/loop_end"];
// Wrap around to max frames, so `-1` can be used to select the end, etc.
if (loop_begin < 0) {
loop_begin = CLAMP(loop_begin + frames + 1, 0, frames);
}
if (loop_end < 0) {
loop_end = CLAMP(loop_end + frames + 1, 0, frames);
}
}
int compression = p_options["compress/mode"];
@ -509,7 +526,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
sample->set_data(dst_data);
sample->set_format(dst_format);
sample->set_mix_rate(rate);
sample->set_loop_mode(loop);
sample->set_loop_mode(loop_mode);
sample->set_loop_begin(loop_begin);
sample->set_loop_end(loop_end);
sample->set_stereo(format_channels == 2);

View file

@ -980,7 +980,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
hbc->add_constant_override("separation", 5 * EDSCALE);
Button *first = memnew(Button);
first->set_text(TTR("First"));
first->set_text(TTR("First", "Pagination"));
if (p_page != 0) {
first->connect("pressed", this, "_search", varray(0));
} else {
@ -990,7 +990,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
hbc->add_child(first);
Button *prev = memnew(Button);
prev->set_text(TTR("Previous"));
prev->set_text(TTR("Previous", "Pagination"));
if (p_page > 0) {
prev->connect("pressed", this, "_search", varray(p_page - 1));
} else {
@ -1020,7 +1020,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
}
Button *next = memnew(Button);
next->set_text(TTR("Next"));
next->set_text(TTR("Next", "Pagination"));
if (p_page < p_page_count - 1) {
next->connect("pressed", this, "_search", varray(p_page + 1));
} else {
@ -1031,7 +1031,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
hbc->add_child(next);
Button *last = memnew(Button);
last->set_text(TTR("Last"));
last->set_text(TTR("Last", "Pagination"));
if (p_page != p_page_count - 1) {
last->connect("pressed", this, "_search", varray(p_page_count - 1));
} else {

View file

@ -274,7 +274,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
menu = memnew(MenuButton);
SpatialEditor::get_singleton()->add_control_to_menu_panel(menu);
menu->set_position(Point2(1, 1));
menu->set_text(TTR("Mesh Library"));
menu->set_text(TTR("MeshLibrary"));
menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshLibrary", "EditorIcons"));
menu->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM);
menu->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM);

View file

@ -2777,7 +2777,10 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
}
if (profile_allow_editing) {
bool add_separator = false;
if (full_selection.size() == 1) {
add_separator = true;
menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME);
}
@ -2790,11 +2793,14 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
}
if (can_replace) {
add_separator = true;
menu->add_icon_shortcut(get_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
}
if (scene_tree->get_selected() != edited_scene) {
if (add_separator) {
menu->add_separator();
}
menu->add_icon_shortcut(get_icon("MoveUp", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP);
menu->add_icon_shortcut(get_icon("MoveDown", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN);
menu->add_icon_shortcut(get_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE);

View file

@ -9,3 +9,4 @@ PrefersNonDefaultGPU=true
Type=Application
MimeType=application/x-godot-project;
Categories=Development;IDE;
StartupWMClass=Godot

View file

@ -972,7 +972,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
// extra const required by C++11 colon/Range operator
// note: do not use C++17 syntax here for dicts.
// this is banned in Godot.
for (std::pair<const std::string, const FBXDocParser::AnimationCurve *> &kvp : curves) {
for (const std::pair<const std::string, const FBXDocParser::AnimationCurve *> &kvp : curves) {
const String curve_element = ImportUtils::FBXNodeToName(kvp.first);
const FBXDocParser::AnimationCurve *curve = kvp.second;
String curve_name = ImportUtils::FBXNodeToName(curve->Name());
@ -988,7 +988,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
const std::map<int64_t, float> &track_time = curve->GetValueTimeTrack();
if (track_time.size() > 0) {
for (std::pair<int64_t, float> keyframe : track_time) {
for (const std::pair<const int64_t, float> &keyframe : track_time) {
if (curve_element == "d|X") {
keyframe_map.keyframes[keyframe.first].x = keyframe.second;
} else if (curve_element == "d|Y") {
@ -1101,7 +1101,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
double max_duration = 0;
double anim_length = animation->get_length();
for (std::pair<int64_t, Vector3> position_key : translation_keys.keyframes) {
for (const std::pair<const int64_t, Vector3> &position_key : translation_keys.keyframes) {
pos_values.push_back(position_key.second * state.scale);
double animation_track_time = CONVERT_FBX_TIME(position_key.first);
@ -1113,7 +1113,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
pos_times.push_back(animation_track_time);
}
for (std::pair<int64_t, Vector3> scale_key : scale_keys.keyframes) {
for (const std::pair<const int64_t, Vector3> &scale_key : scale_keys.keyframes) {
scale_values.push_back(scale_key.second);
double animation_track_time = CONVERT_FBX_TIME(scale_key.first);
@ -1148,7 +1148,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
Quat lastQuat = Quat();
for (std::pair<int64_t, Vector3> rotation_key : rotation_keys.keyframes) {
for (const std::pair<const int64_t, Vector3> &rotation_key : rotation_keys.keyframes) {
double animation_track_time = CONVERT_FBX_TIME(rotation_key.first);
//print_verbose("euler rotation key: " + rotation_key.second);

View file

@ -135,7 +135,7 @@ const GodotWebSocket = {
if (!ref) {
return;
}
GodotWebSocket.close(p_id, 1001, '');
GodotWebSocket.close(p_id, 3001, 'destroyed');
IDHandler.remove(p_id);
ref.onopen = null;
ref.onmessage = null;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 351 KiB

View file

@ -1467,7 +1467,7 @@ void KinematicBody2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision/safe_margin", PROPERTY_HINT_RANGE, "0.001,256,0.001"), "set_safe_margin", "get_safe_margin");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "motion/sync_to_physics"), "set_sync_to_physics", "is_sync_to_physics_enabled");
ADD_GROUP("Moving platform", "moving_platform");
ADD_GROUP("Moving Platform", "moving_platform");
ADD_PROPERTY(PropertyInfo(Variant::INT, "moving_platform_apply_velocity_on_leave", PROPERTY_HINT_ENUM, "Always,Upward Only,Never", PROPERTY_USAGE_DEFAULT), "set_moving_platform_apply_velocity_on_leave", "get_moving_platform_apply_velocity_on_leave");
BIND_ENUM_CONSTANT(PLATFORM_VEL_ON_LEAVE_ALWAYS);

View file

@ -1480,7 +1480,7 @@ void KinematicBody::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision/safe_margin", PROPERTY_HINT_RANGE, "0.001,256,0.001"), "set_safe_margin", "get_safe_margin");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "motion/sync_to_physics"), "set_sync_to_physics", "is_sync_to_physics_enabled");
ADD_GROUP("Moving platform", "moving_platform");
ADD_GROUP("Moving Platform", "moving_platform");
ADD_PROPERTY(PropertyInfo(Variant::INT, "moving_platform_apply_velocity_on_leave", PROPERTY_HINT_ENUM, "Always,Upward Only,Never", PROPERTY_USAGE_DEFAULT), "set_moving_platform_apply_velocity_on_leave", "get_moving_platform_apply_velocity_on_leave");
BIND_ENUM_CONSTANT(PLATFORM_VEL_ON_LEAVE_ALWAYS);

View file

@ -89,6 +89,7 @@ public:
FORMAT_IMA_ADPCM
};
// Keep the ResourceImporterWAV `edit/loop_mode` enum hint in sync with these options.
enum LoopMode {
LOOP_DISABLED,
LOOP_FORWARD,

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "capsule_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> CapsuleShape::get_debug_mesh_lines() {
@ -106,8 +107,8 @@ void CapsuleShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape::get_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_height", "get_height");
}
CapsuleShape::CapsuleShape() :

View file

@ -109,8 +109,8 @@ void CapsuleShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape2D::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape2D::get_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_height", "get_height");
}
CapsuleShape2D::CapsuleShape2D() :

View file

@ -55,7 +55,7 @@ void CircleShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CircleShape2D::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &CircleShape2D::get_radius);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,16384,0.5"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius");
}
Rect2 CircleShape2D::get_rect() const {

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "cylinder_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> CylinderShape::get_debug_mesh_lines() {
@ -99,8 +100,8 @@ void CylinderShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CylinderShape::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CylinderShape::get_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_radius", "get_radius");
}
CylinderShape::CylinderShape() :

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "height_map_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
@ -191,8 +192,8 @@ void HeightMapShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape::set_map_data);
ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape::get_map_data);
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_map_width", "get_map_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_map_depth", "get_map_depth");
ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "map_data"), "set_map_data", "get_map_data");
}

View file

@ -105,7 +105,7 @@ void LineShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_d"), &LineShape2D::get_d);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "normal"), "set_normal", "get_normal");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "d"), "set_d", "get_d");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "d", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_d", "get_d");
}
LineShape2D::LineShape2D() :

View file

@ -81,7 +81,7 @@ void RayShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape::set_slips_on_slope);
ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape::get_slips_on_slope);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope");
}

View file

@ -141,7 +141,7 @@ void RayShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape2D::set_slips_on_slope);
ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape2D::get_slips_on_slope);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope");
}

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "sphere_shape.h"
#include "servers/physics_server.h"
Vector<Vector3> SphereShape::get_debug_mesh_lines() {
@ -77,7 +78,7 @@ void SphereShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &SphereShape::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &SphereShape::get_radius);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100,0.001,or_greater"), "set_radius", "get_radius");
}
SphereShape::SphereShape() :