Merge pull request #36494 from akien-mga/callable-fixes

Fix some signals and non-debug branch for callable_mp
This commit is contained in:
Rémi Verschelde 2020-02-24 08:00:23 +01:00 committed by GitHub
commit 128a55a597
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 29 additions and 61 deletions

View file

@ -134,7 +134,7 @@ void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), con
#ifdef DEBUG_METHODS_ENABLED
(p_instance->*p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
#else
(p_instance->*p_method)(VariantCaster<P...>::cast(p_args[Is])...);
(p_instance->*p_method)(VariantCaster<P>::cast(p_args[Is])...);
#endif
}
@ -201,6 +201,15 @@ Callable create_custom_callable_function_pointer(T *p_instance,
// VERSION WITH RETURN
// GCC 8 raises "parameter 'p_args' set but not used" here, probably using a
// template version that does not have arguments and thus sees it unused, but
// obviously the template can be used for functions with and without them, and
// the optimizer will get rid of it anyway.
#if defined(DEBUG_METHODS_ENABLED) && defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#endif
template <class T, class R, class... P, size_t... Is>
void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, Variant &r_ret, Callable::CallError &r_error, IndexSequence<Is...>) {
r_error.error = Callable::CallError::CALL_OK;
@ -208,10 +217,14 @@ void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), co
#ifdef DEBUG_METHODS_ENABLED
r_ret = (p_instance->*p_method)(VariantCasterAndValidate<P>::cast(p_args, Is, r_error)...);
#else
(p_instance->*p_method)(VariantCaster<P...>::cast(p_args[Is])...);
(p_instance->*p_method)(VariantCaster<P>::cast(p_args[Is])...);
#endif
}
#if defined(DEBUG_METHODS_ENABLED) && defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
template <class T, class R, class... P>
void call_with_variant_args_ret(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) {
#ifdef DEBUG_METHODS_ENABLED

View file

@ -5707,7 +5707,7 @@ float AnimationTrackEditor::snap_time(float p_value, bool p_relative) {
return p_value;
}
void AnimationTrackEditor::_show_imported_anim_warning() const {
void AnimationTrackEditor::_show_imported_anim_warning() {
// It looks terrible on a single line but the TTR extractor doesn't support line breaks yet.
EditorNode::get_singleton()->show_warning(TTR("This animation belongs to an imported scene, so changes to imported tracks will not be saved.\n\nTo enable the ability to add custom tracks, navigate to the scene's import settings and set\n\"Animation > Storage\" to \"Files\", enable \"Animation > Keep Custom Tracks\", then re-import.\nAlternatively, use an import preset that imports animations to separate files."),

View file

@ -314,7 +314,7 @@ class AnimationTrackEditor : public VBoxContainer {
OptionButton *snap_mode;
Button *imported_anim_warning;
void _show_imported_anim_warning() const;
void _show_imported_anim_warning();
void _snap_mode_changed(int p_mode);
Vector<AnimationTrackEdit *> track_edits;

View file

@ -1775,7 +1775,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
}
void FileSystemDock::_resource_created() const {
void FileSystemDock::_resource_created() {
Object *c = new_resource_dialog->instance_selected();
ERR_FAIL_COND(!c);

View file

@ -215,7 +215,7 @@ private:
void _files_moved(String p_old_file, String p_new_file);
void _folder_moved(String p_old_folder, String p_new_folder);
void _resource_created() const;
void _resource_created();
void _make_dir_confirm();
void _make_scene_confirm();
void _rename_operation_confirm();

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "groups_editor.h"
#include "editor/scene_tree_editor.h"
#include "editor_node.h"
#include "editor_scale.h"
@ -468,7 +469,6 @@ GroupDialog::GroupDialog() {
nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
nodes_to_add->add_constant_override("draw_guides", 1);
nodes_to_add->connect_compat("item_selected", this, "_nodes_to_add_selected");
HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
add_filter_hbc->add_constant_override("separate", 0);
@ -515,7 +515,6 @@ GroupDialog::GroupDialog() {
nodes_to_remove->set_hide_folding(true);
nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
nodes_to_remove->add_constant_override("draw_guides", 1);
nodes_to_remove->connect_compat("item_selected", this, "_node_to_remove_selected");
HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
remove_filter_hbc->add_constant_override("separate", 0);

View file

@ -260,7 +260,7 @@ void InspectorDock::_prepare_history() {
}
}
void InspectorDock::_select_history(int p_idx) const {
void InspectorDock::_select_history(int p_idx) {
//push it to the top, it is not correct, but it's more useful
ObjectID id = EditorNode::get_singleton()->get_editor_history()->get_history_obj(p_idx);
Object *obj = ObjectDB::get_instance(id);
@ -269,7 +269,7 @@ void InspectorDock::_select_history(int p_idx) const {
editor->push_item(obj);
}
void InspectorDock::_resource_created() const {
void InspectorDock::_resource_created() {
Object *c = new_resource_dialog->instance_selected();
ERR_FAIL_COND(!c);
@ -280,7 +280,7 @@ void InspectorDock::_resource_created() const {
editor->push_item(c);
}
void InspectorDock::_resource_selected(const RES &p_res, const String &p_property) const {
void InspectorDock::_resource_selected(const RES &p_res, const String &p_property) {
if (p_res.is_null())
return;

View file

@ -104,13 +104,13 @@ class InspectorDock : public VBoxContainer {
void _paste_resource() const;
void _warning_pressed();
void _resource_created() const;
void _resource_selected(const RES &p_res, const String &p_property = "") const;
void _resource_created();
void _resource_selected(const RES &p_res, const String &p_property = "");
void _edit_forward();
void _edit_back();
void _menu_collapseall();
void _menu_expandall();
void _select_history(int p_idx) const;
void _select_history(int p_idx);
void _prepare_history();
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);

View file

@ -38,10 +38,8 @@
#include "editor/animation_track_editor.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
// For onion skinning.
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning.
#include "editor/plugins/spatial_editor_plugin.h" // For onion skinning.
#include "scene/main/viewport.h"
#include "servers/visual_server.h"
@ -375,8 +373,7 @@ void AnimationPlayerEditor::_animation_save_in_path(const Ref<Resource> &p_resou
Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
if (err != OK) {
accept->set_text(TTR("Error saving resource!"));
accept->popup_centered_minsize();
EditorNode::get_singleton()->show_warning(TTR("Error saving resource!"));
return;
}
@ -1628,10 +1625,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
scale->set_tooltip(TTR("Scale animation playback globally for the node."));
scale->hide();
accept = memnew(AcceptDialog);
add_child(accept);
accept->connect_compat("confirmed", this, "_menu_confirm_current");
delete_dialog = memnew(ConfirmationDialog);
add_child(delete_dialog);
delete_dialog->connect_compat("confirmed", this, "_animation_remove_confirmed");

View file

@ -110,7 +110,6 @@ class AnimationPlayerEditor : public VBoxContainer {
float timeline_position;
EditorFileDialog *file;
AcceptDialog *accept;
ConfirmationDialog *delete_dialog;
int current_option;

View file

@ -51,12 +51,6 @@ void CPUParticlesEditor::_menu_option(int p_option) {
switch (p_option) {
case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH: {
emission_file_dialog->popup_centered_ratio();
} break;
case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE: {
emission_tree_dialog->popup_centered_ratio();
@ -112,7 +106,6 @@ CPUParticlesEditor::CPUParticlesEditor() {
particles_editor_hb->hide();
options->set_text(TTR("CPUParticles"));
options->get_popup()->add_item(TTR("Create Emission Points From Mesh"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH);
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);

View file

@ -41,7 +41,6 @@ class CPUParticlesEditor : public ParticlesEditorBase {
enum Menu {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE,
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
MENU_OPTION_RESTART

View file

@ -231,23 +231,9 @@ ParticlesEditorBase::ParticlesEditorBase() {
emission_dialog->get_ok()->set_text(TTR("Create"));
emission_dialog->connect_compat("confirmed", this, "_generate_emission_points");
emission_file_dialog = memnew(EditorFileDialog);
add_child(emission_file_dialog);
emission_file_dialog->connect_compat("file_selected", this, "_resource_seleted");
emission_tree_dialog = memnew(SceneTreeDialog);
add_child(emission_tree_dialog);
emission_tree_dialog->connect_compat("selected", this, "_node_selected");
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Mesh", &extensions);
emission_file_dialog->clear_filters();
for (int i = 0; i < extensions.size(); i++) {
emission_file_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
}
emission_file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
}
void ParticlesEditor::_node_removed(Node *p_node) {
@ -279,17 +265,6 @@ void ParticlesEditor::_menu_option(int p_option) {
generate_seconds->set_value(trunc(gen_time) + 1.0);
generate_aabb->popup_centered_minsize();
} break;
case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH: {
Ref<ParticlesMaterial> material = node->get_process_material();
if (material.is_null()) {
EditorNode::get_singleton()->show_warning(TTR("A processor material of type 'ParticlesMaterial' is required."));
return;
}
emission_file_dialog->popup_centered_ratio();
} break;
case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE: {
Ref<ParticlesMaterial> material = node->get_process_material();
if (material.is_null()) {
@ -467,7 +442,6 @@ ParticlesEditor::ParticlesEditor() {
options->set_text(TTR("Particles"));
options->get_popup()->add_item(TTR("Generate AABB"), MENU_OPTION_GENERATE_AABB);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Create Emission Points From Mesh"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH);
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);

View file

@ -46,7 +46,6 @@ protected:
MenuButton *options;
HBoxContainer *particles_editor_hb;
EditorFileDialog *emission_file_dialog;
SceneTreeDialog *emission_tree_dialog;
ConfirmationDialog *emission_dialog;
@ -77,7 +76,6 @@ class ParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_GENERATE_AABB,
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE,
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
MENU_OPTION_RESTART,