Removed the CONNECT and DISCONNECT macros.

This commit is contained in:
Relintai 2022-03-18 10:32:50 +01:00
parent acf01d3cec
commit 4050779e1f
15 changed files with 60 additions and 85 deletions

View File

@ -16,7 +16,4 @@
arr_into.push_back(e); \
}
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
#endif

View File

@ -4363,8 +4363,8 @@ void Entity::skill_adds(Ref<EntitySkill> skill) {
if (skill_hass(skill))
return;
skill->CONNECT("current_changed", this, Entity, skill_scurrent_changed);
skill->CONNECT("max_changed", this, Entity, skill_smax_changed);
skill->connect("current_changed", this, "skill_scurrent_changed");
skill->connect("max_changed", this, "skill_smax_changed");
_s_skills.push_back(skill);
@ -5175,23 +5175,23 @@ Ref<Bag> Entity::gets_bag() const {
}
void Entity::sets_bag(const Ref<Bag> bag) {
if (_s_bag.is_valid()) {
_s_bag->DISCONNECT("item_added", this, Entity, notification_item_sadded);
_s_bag->DISCONNECT("item_removed", this, Entity, notification_item_sremoved);
_s_bag->DISCONNECT("item_swapped", this, Entity, notification_items_sswapped);
_s_bag->DISCONNECT("item_count_changed", this, Entity, notification_item_sscount_changed);
_s_bag->DISCONNECT("overburdened", this, Entity, notification_soverburdened);
_s_bag->DISCONNECT("overburden_removed", this, Entity, notification_soverburden_removed);
_s_bag->disconnect("item_added", this, "notification_item_sadded");
_s_bag->disconnect("item_removed", this, "notification_item_sremoved");
_s_bag->disconnect("item_swapped", this, "notification_items_sswapped");
_s_bag->disconnect("item_count_changed", this, "notification_item_sscount_changed");
_s_bag->disconnect("overburdened", this, "notification_soverburdened");
_s_bag->disconnect("overburden_removed", this, "notification_soverburden_removed");
}
_s_bag = bag;
if (_s_bag.is_valid()) {
_s_bag->CONNECT("item_added", this, Entity, notification_item_sadded);
_s_bag->CONNECT("item_removed", this, Entity, notification_item_sremoved);
_s_bag->CONNECT("item_swapped", this, Entity, notification_items_sswapped);
_s_bag->CONNECT("item_count_changed", this, Entity, notification_item_sscount_changed);
_s_bag->CONNECT("overburdened", this, Entity, notification_soverburdened);
_s_bag->CONNECT("overburden_removed", this, Entity, notification_soverburden_removed);
_s_bag->connect("item_added", this, "notification_item_sadded");
_s_bag->connect("item_removed", this, "notification_item_sremoved");
_s_bag->connect("item_swapped", this, "notification_items_sswapped");
_s_bag->connect("item_count_changed", this, "notification_item_sscount_changed");
_s_bag->connect("overburdened", this, "notification_soverburdened");
_s_bag->connect("overburden_removed", this, "notification_soverburden_removed");
}
emit_signal("sbag_changed", this, _s_bag);
@ -5217,19 +5217,19 @@ Ref<Bag> Entity::gets_target_bag() const {
}
void Entity::sets_target_bag(const Ref<Bag> bag) {
if (_s_target_bag.is_valid()) {
_s_target_bag->DISCONNECT("item_added", this, Entity, notification_target_item_sadded);
_s_target_bag->DISCONNECT("item_removed", this, Entity, notification_target_item_sremoved);
_s_target_bag->DISCONNECT("item_swapped", this, Entity, notification_target_items_sswapped);
_s_target_bag->DISCONNECT("item_count_changed", this, Entity, notification_target_item_sscount_changed);
_s_target_bag->disconnect("item_added", this, "notification_target_item_sadded");
_s_target_bag->disconnect("item_removed", this, "notification_target_item_sremoved");
_s_target_bag->disconnect("item_swapped", this, "notification_target_items_sswapped");
_s_target_bag->disconnect("item_count_changed", this, "notification_target_item_sscount_changed");
}
_s_target_bag = bag;
if (_s_target_bag.is_valid()) {
_s_target_bag->CONNECT("item_added", this, Entity, notification_target_item_sadded);
_s_target_bag->CONNECT("item_removed", this, Entity, notification_target_item_sremoved);
_s_target_bag->CONNECT("item_swapped", this, Entity, notification_target_items_sswapped);
_s_target_bag->CONNECT("item_count_changed", this, Entity, notification_target_item_sscount_changed);
_s_target_bag->connect("item_added", this, "notification_target_item_sadded");
_s_target_bag->connect("item_removed", this, "notification_target_item_sremoved");
_s_target_bag->connect("item_swapped", this, "notification_target_items_sswapped");
_s_target_bag->connect("item_count_changed", this, "notification_target_item_sscount_changed");
}
emit_signal("starget_bag_changed", this, _s_target_bag);

View File

@ -61,7 +61,7 @@ Ref<ClassProfile> PlayerProfile::get_class_profile_index(const int index) {
}
void PlayerProfile::add_class_profile(Ref<ClassProfile> profile) {
profile->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
profile->connect("changed", this, "_on_class_profile_changed");
_class_profiles.push_back(profile);
@ -70,7 +70,7 @@ void PlayerProfile::add_class_profile(Ref<ClassProfile> profile) {
void PlayerProfile::clear_class_profiles() {
for (int i = 0; i < _class_profiles.size(); ++i) {
_class_profiles.get(i)->DISCONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
_class_profiles.get(i)->disconnect("changed", this, "_on_class_profile_changed");
}
_class_profiles.clear();
@ -79,7 +79,7 @@ void PlayerProfile::clear_class_profiles() {
}
void PlayerProfile::remove_class_profile(const int index) {
_class_profiles.get(index)->DISCONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
_class_profiles.get(index)->disconnect("changed", this, "_on_class_profile_changed");
_class_profiles.remove(index);
@ -101,7 +101,7 @@ Ref<ClassProfile> PlayerProfile::get_class_profile(const StringName &class_path)
class_profile->load_defaults();
class_profile->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
class_profile->connect("changed", this, "_on_class_profile_changed");
_class_profiles.push_back(Ref<ClassProfile>(class_profile));
@ -159,7 +159,7 @@ void PlayerProfile::from_dict(const Dictionary &dict) {
c->from_dict(arr.get(i));
c->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
c->connect("changed", this, "_on_class_profile_changed");
_class_profiles.push_back(c);
}
@ -187,7 +187,7 @@ void PlayerProfile::load_defaults() {
for (int i = 0; i < _class_profiles.size(); ++i) {
_class_profiles.get(i)->load_defaults();
_class_profiles.get(i)->CONNECT("changed", this, PlayerProfile, _on_class_profile_changed);
_class_profiles.get(i)->connect("changed", this, "_on_class_profile_changed");
}
emit_change();

View File

@ -167,9 +167,9 @@ void ProfileManager::from_dict(const Dictionary &dict) {
clears_player_profiles();
_c_player_profile->DISCONNECT("changed", this, ProfileManager, _on_player_profile_changed);
_c_player_profile->disconnect("changed", this, "_on_player_profile_changed");
_c_player_profile->from_dict(dict.get("cplayer_profile", Dictionary()));
_c_player_profile->CONNECT("changed", this, ProfileManager, _on_player_profile_changed);
_c_player_profile->connect("changed", this, "_on_player_profile_changed");
Array arr = dict.get("splayer_profiles", Array());
@ -179,7 +179,7 @@ void ProfileManager::from_dict(const Dictionary &dict) {
c->from_dict(arr.get(i));
c->CONNECT("changed", this, ProfileManager, _on_player_profile_changed);
c->connect("changed", this, "_on_player_profile_changed");
_s_player_profiles.push_back(c);
}
@ -200,7 +200,7 @@ ProfileManager::ProfileManager() {
_c_player_profile.instance();
_c_player_profile->CONNECT("changed", this, ProfileManager, _on_player_profile_changed);
_c_player_profile->connect("changed", this, "_on_player_profile_changed");
if (!Engine::get_singleton()->is_editor_hint() && _automatic_load)
call_deferred("load");
@ -209,7 +209,7 @@ ProfileManager::ProfileManager() {
ProfileManager::~ProfileManager() {
_instance = NULL;
_c_player_profile->DISCONNECT("changed", this, ProfileManager, _on_player_profile_changed);
_c_player_profile->disconnect("changed", this, "_on_player_profile_changed");
_s_player_profiles.clear();
}

View File

@ -16,7 +16,4 @@
arr_into.push_back(e); \
}
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
#endif

View File

@ -28,9 +28,6 @@ SOFTWARE.
#include "core/os/input.h"
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
void PropEditorPlugin::convert_active_scene_to_prop_data() {
SceneTree *st = SceneTree::get_singleton();
@ -109,7 +106,7 @@ PropEditorPlugin::PropEditorPlugin(EditorNode *p_node) {
container->add_child(b);
b->set_flat(true);
b->CONNECT("pressed", this, PropEditorPlugin, _quick_convert_button_pressed);
b->connect("pressed", this, "_quick_convert_button_pressed");
b->set_text("To Prop");
b->set_shortcut(ED_SHORTCUT("spatial_editor/quick_prop_convert", "Quick convert scene to PropData.", KEY_MASK_ALT + KEY_U));

View File

@ -28,9 +28,6 @@ SOFTWARE.
#include "core/os/input.h"
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
void Prop2DEditorPlugin::convert_active_scene_to_prop_data() {
SceneTree *st = SceneTree::get_singleton();
@ -103,7 +100,7 @@ Prop2DEditorPlugin::Prop2DEditorPlugin(EditorNode *p_node) {
Button *b = memnew(Button);
b->CONNECT("pressed", this, Prop2DEditorPlugin, _quick_convert_button_pressed);
b->connect("pressed", this, "_quick_convert_button_pressed");
b->set_text("To Prop2D");
b->set_shortcut(ED_SHORTCUT("spatial_editor/quick_prop_convert", "Quick convert scene to Prop2DData.", KEY_MASK_ALT + KEY_U));

View File

@ -16,9 +16,6 @@
arr_into.push_back(e); \
}
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
#define CALL(func, ...) \
call(#func, ##__VA_ARGS__);

View File

@ -164,7 +164,7 @@ void TerrainWorldEditor::edit(TerrainWorld *p_world) {
button->set_button_group(_surfaces_button_group);
button->set_h_size_flags(SIZE_EXPAND_FILL);
button->CONNECT("button_up", this, TerrainWorldEditor, _on_surface_button_pressed);
button->connect("button_up", this, "_on_surface_button_pressed");
_surfaces_vbox_container->add_child(button);
@ -208,7 +208,7 @@ TerrainWorldEditor::TerrainWorldEditor(EditorNode *p_editor) {
add_button->set_button_group(_tool_button_group);
add_button->set_meta("tool_mode", TOOL_MODE_ADD);
add_button->CONNECT("button_up", this, TerrainWorldEditor, _on_tool_button_pressed);
add_button->connect("button_up", this, "_on_tool_button_pressed");
add_button->set_shortcut(ED_SHORTCUT("voxelman_world_editor/add_mode", "Add Mode", KEY_A));
spatial_editor_hb->add_child(add_button);
@ -219,7 +219,7 @@ TerrainWorldEditor::TerrainWorldEditor(EditorNode *p_editor) {
remove_button->set_button_group(_tool_button_group);
remove_button->set_meta("tool_mode", TOOL_MODE_REMOVE);
remove_button->CONNECT("button_up", this, TerrainWorldEditor, _on_tool_button_pressed);
remove_button->connect("button_up", this, "_on_tool_button_pressed");
remove_button->set_shortcut(ED_SHORTCUT("voxelman_world_editor/remove_mode", "Remove Mode", KEY_S));
spatial_editor_hb->add_child(remove_button);
@ -227,7 +227,7 @@ TerrainWorldEditor::TerrainWorldEditor(EditorNode *p_editor) {
ToolButton *insert_buton = memnew(ToolButton);
insert_buton->set_text("Insert");
insert_buton->CONNECT("button_up", this, TerrainWorldEditor, _on_insert_block_at_camera_button_pressed);
insert_buton->connect("button_up", this, "_on_insert_block_at_camera_button_pressed");
insert_buton->set_shortcut(ED_SHORTCUT("voxelman_world_editor/instert_block_at_camera", "Insert at camera", KEY_B));
spatial_editor_hb->add_child(insert_buton);
@ -242,7 +242,7 @@ TerrainWorldEditor::TerrainWorldEditor(EditorNode *p_editor) {
_isolevel_slider->set_v_size_flags(SIZE_EXPAND_FILL);
spatial_editor_hb->add_child(_isolevel_slider);
_isolevel_slider->CONNECT("value_changed", this, TerrainWorldEditor, _on_isolevel_slider_value_changed);
_isolevel_slider->connect("value_changed", this, "_on_isolevel_slider_value_changed");
_isolevel_slider->hide();

View File

@ -16,9 +16,6 @@
arr_into.push_back(e); \
}
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
#define CALL(func, ...) \
call(#func, ##__VA_ARGS__);

View File

@ -163,7 +163,7 @@ void Terrain2DWorldEditor::edit(Terrain2DWorld *p_world) {
button->set_button_group(_surfaces_button_group);
button->set_h_size_flags(SIZE_EXPAND_FILL);
button->CONNECT("button_up", this, Terrain2DWorldEditor, _on_surface_button_pressed);
button->connect("button_up", this, "_on_surface_button_pressed");
_surfaces_vbox_container->add_child(button);
@ -207,7 +207,7 @@ Terrain2DWorldEditor::Terrain2DWorldEditor(EditorNode *p_editor) {
add_button->set_button_group(_tool_button_group);
add_button->set_meta("tool_mode", TOOL_MODE_ADD);
add_button->CONNECT("button_up", this, Terrain2DWorldEditor, _on_tool_button_pressed);
add_button->connect("button_up", this, "_on_tool_button_pressed");
add_button->set_shortcut(ED_SHORTCUT("voxelman_world_editor/add_mode", "Add Mode", KEY_A));
spatial_editor_hb->add_child(add_button);
@ -218,7 +218,7 @@ Terrain2DWorldEditor::Terrain2DWorldEditor(EditorNode *p_editor) {
remove_button->set_button_group(_tool_button_group);
remove_button->set_meta("tool_mode", TOOL_MODE_REMOVE);
remove_button->CONNECT("button_up", this, Terrain2DWorldEditor, _on_tool_button_pressed);
remove_button->connect("button_up", this, "_on_tool_button_pressed");
remove_button->set_shortcut(ED_SHORTCUT("voxelman_world_editor/remove_mode", "Remove Mode", KEY_S));
spatial_editor_hb->add_child(remove_button);
@ -226,7 +226,7 @@ Terrain2DWorldEditor::Terrain2DWorldEditor(EditorNode *p_editor) {
ToolButton *insert_buton = memnew(ToolButton);
insert_buton->set_text("Insert");
insert_buton->CONNECT("button_up", this, Terrain2DWorldEditor, _on_insert_block_at_camera_button_pressed);
insert_buton->connect("button_up", this, "_on_insert_block_at_camera_button_pressed");
insert_buton->set_shortcut(ED_SHORTCUT("voxelman_world_editor/instert_block_at_camera", "Insert at camera", KEY_B));
spatial_editor_hb->add_child(insert_buton);
@ -241,7 +241,7 @@ Terrain2DWorldEditor::Terrain2DWorldEditor(EditorNode *p_editor) {
_isolevel_slider->set_v_size_flags(SIZE_EXPAND_FILL);
spatial_editor_hb->add_child(_isolevel_slider);
_isolevel_slider->CONNECT("value_changed", this, Terrain2DWorldEditor, _on_isolevel_slider_value_changed);
_isolevel_slider->connect("value_changed", this, "_on_isolevel_slider_value_changed");
_isolevel_slider->hide();

View File

@ -30,9 +30,6 @@ SOFTWARE.
#include "core/os/os.h"
#include "scene/main/scene_tree.h"
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
ThreadPool *ThreadPool::_instance;
ThreadPool *ThreadPool::get_singleton() {
@ -241,7 +238,7 @@ void ThreadPool::_worker_thread_func(void *user_data) {
}
void ThreadPool::register_update() {
SceneTree::get_singleton()->CONNECT("idle_frame", this, ThreadPool, update);
SceneTree::get_singleton()->connect("idle_frame", this, "update");
}
void ThreadPool::update() {

View File

@ -42,7 +42,6 @@
#include "scene/gui/margin_container.h"
#include "core/input_map.h"
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
static const char *_button_names[JOY_BUTTON_MAX] = {
"DualShock Cross, Xbox A, Nintendo B",
@ -914,15 +913,15 @@ InputMapEditor::InputMapEditor() {
input_editor->set_column_expand(2, false);
input_editor->set_column_min_width(2, 50);
input_editor->CONNECT("item_edited", this, InputMapEditor, _action_edited);
input_editor->CONNECT("item_activated", this, InputMapEditor, _action_activated);
input_editor->CONNECT("cell_selected", this, InputMapEditor, _action_selected);
input_editor->CONNECT("button_pressed", this, InputMapEditor, _action_button_pressed);
input_editor->connect("item_edited", this, "_action_edited");
input_editor->connect("item_activated", this, "_action_activated");
input_editor->connect("cell_selected", this, "_action_selected");
input_editor->connect("button_pressed", this, "_action_button_pressed");
input_editor->set_drag_forwarding(this);
popup_add = memnew(PopupMenu);
add_child(popup_add);
popup_add->CONNECT("id_pressed", this, InputMapEditor, _add_item);
popup_add->connect("id_pressed", this, "_add_item");
press_a_key = memnew(ConfirmationDialog);
press_a_key->set_focus_mode(FOCUS_ALL);
@ -941,15 +940,15 @@ InputMapEditor::InputMapEditor() {
press_a_key_label = l;
press_a_key->add_child(l);
press_a_key->CONNECT("gui_input", this, InputMapEditor, _wait_for_key);
press_a_key->CONNECT("confirmed", this, InputMapEditor, _press_a_key_confirm);
press_a_key->connect("gui_input", this, "_wait_for_key");
press_a_key->connect("confirmed", this, "_press_a_key_confirm");
device_input = memnew(ConfirmationDialog);
add_child(device_input);
device_input->get_ok()->set_text("Add");
device_input->CONNECT("confirmed", this, InputMapEditor, _device_input_add);
device_input->connect("confirmed", this, "_device_input_add");
HBoxContainer *hbc = memnew(HBoxContainer);
device_input->add_child(hbc);
@ -985,7 +984,7 @@ InputMapEditor::InputMapEditor() {
timer = memnew(Timer);
timer->set_wait_time(1.5);
timer->CONNECT("timeout", ProjectSettings::get_singleton(), ProjectSettings, save);
timer->connect("timeout", ProjectSettings::get_singleton(), "save");
timer->set_one_shot(true);
add_child(timer);
}

View File

@ -16,7 +16,4 @@
arr_into.push_back(e); \
}
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
#endif

View File

@ -164,7 +164,7 @@ void VoxelWorldEditor::edit(VoxelWorld *p_world) {
button->set_button_group(_surfaces_button_group);
button->set_h_size_flags(SIZE_EXPAND_FILL);
button->CONNECT("button_up", this, VoxelWorldEditor, _on_surface_button_pressed);
button->connect("button_up", this, "_on_surface_button_pressed");
_surfaces_vbox_container->add_child(button);
@ -208,7 +208,7 @@ VoxelWorldEditor::VoxelWorldEditor(EditorNode *p_editor) {
add_button->set_button_group(_tool_button_group);
add_button->set_meta("tool_mode", TOOL_MODE_ADD);
add_button->CONNECT("button_up", this, VoxelWorldEditor, _on_tool_button_pressed);
add_button->connect("button_up", this, "_on_tool_button_pressed");
add_button->set_shortcut(ED_SHORTCUT("voxel_world_editor/add_mode", "Add Mode", KEY_A));
@ -220,7 +220,7 @@ VoxelWorldEditor::VoxelWorldEditor(EditorNode *p_editor) {
remove_button->set_button_group(_tool_button_group);
remove_button->set_meta("tool_mode", TOOL_MODE_REMOVE);
remove_button->CONNECT("button_up", this, VoxelWorldEditor, _on_tool_button_pressed);
remove_button->connect("button_up", this, "_on_tool_button_pressed");
remove_button->set_shortcut(ED_SHORTCUT("voxel_world_editor/remove_mode", "Remove Mode", KEY_S));
@ -229,7 +229,7 @@ VoxelWorldEditor::VoxelWorldEditor(EditorNode *p_editor) {
ToolButton *insert_buton = memnew(ToolButton);
insert_buton->set_text("Insert");
insert_buton->CONNECT("button_up", this, VoxelWorldEditor, _on_insert_block_at_camera_button_pressed);
insert_buton->connect("button_up", this, "_on_insert_block_at_camera_button_pressed");
insert_buton->set_shortcut(ED_SHORTCUT("voxel_world_editor/instert_block_at_camera", "Insert at camera", KEY_B));
@ -245,7 +245,7 @@ VoxelWorldEditor::VoxelWorldEditor(EditorNode *p_editor) {
_isolevel_slider->set_v_size_flags(SIZE_EXPAND_FILL);
spatial_editor_hb->add_child(_isolevel_slider);
_isolevel_slider->CONNECT("value_changed", this, VoxelWorldEditor, _on_isolevel_slider_value_changed);
_isolevel_slider->connect("value_changed", this, "_on_isolevel_slider_value_changed");
_isolevel_slider->hide();