Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const lvalue ref to scene/* container parameters #88974

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/multiplayer/scene_multiplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ Error SceneMultiplayer::rpcp(Object *p_obj, int p_peer_id, const StringName &p_m
return rpc->rpcp(p_obj, p_peer_id, p_method, p_arg, p_argcount);
}

Error SceneMultiplayer::object_configuration_add(Object *p_obj, Variant p_config) {
Error SceneMultiplayer::object_configuration_add(Object *p_obj, const Variant &p_config) {
if (p_obj == nullptr && p_config.get_type() == Variant::NODE_PATH) {
set_root_path(p_config);
return OK;
Expand All @@ -596,7 +596,7 @@ Error SceneMultiplayer::object_configuration_add(Object *p_obj, Variant p_config
return ERR_INVALID_PARAMETER;
}

Error SceneMultiplayer::object_configuration_remove(Object *p_obj, Variant p_config) {
Error SceneMultiplayer::object_configuration_remove(Object *p_obj, const Variant &p_config) {
if (p_obj == nullptr && p_config.get_type() == Variant::NODE_PATH) {
ERR_FAIL_COND_V(root_path != p_config.operator NodePath(), ERR_INVALID_PARAMETER);
set_root_path(NodePath());
Expand Down
4 changes: 2 additions & 2 deletions modules/multiplayer/scene_multiplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ class SceneMultiplayer : public MultiplayerAPI {

virtual Error rpcp(Object *p_obj, int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount) override;

virtual Error object_configuration_add(Object *p_obj, Variant p_config) override;
virtual Error object_configuration_remove(Object *p_obj, Variant p_config) override;
virtual Error object_configuration_add(Object *p_obj, const Variant &p_config) override;
virtual Error object_configuration_remove(Object *p_obj, const Variant &p_config) override;

void clear();

Expand Down
2 changes: 1 addition & 1 deletion scene/2d/tile_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void TileMap::remove_layer(int p_layer) {
update_configuration_warnings();
}

void TileMap::set_layer_name(int p_layer, String p_name) {
void TileMap::set_layer_name(int p_layer, const String &p_name) {
TILEMAP_CALL_FOR_LAYER(p_layer, set_name, p_name);
}

Expand Down
2 changes: 1 addition & 1 deletion scene/2d/tile_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class TileMap : public Node2D {
void move_layer(int p_layer, int p_to_pos);
void remove_layer(int p_layer);

void set_layer_name(int p_layer, String p_name);
void set_layer_name(int p_layer, const String &p_name);
String get_layer_name(int p_layer) const;
void set_layer_enabled(int p_layer, bool p_visible);
bool is_layer_enabled(int p_layer) const;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/audio_stream_player_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void AudioStreamPlayer3D::_calc_output_vol(const Vector3 &source_dir, real_t tig
}
}

void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_pos, Vector<AudioFrame> direct_path_vol, Vector<AudioFrame> &reverb_vol) {
void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_pos, const Vector<AudioFrame> &direct_path_vol, Vector<AudioFrame> &reverb_vol) {
reverb_vol.resize(4);
reverb_vol.write[0] = AudioFrame(0, 0);
reverb_vol.write[1] = AudioFrame(0, 0);
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/audio_stream_player_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AudioStreamPlayer3D : public Node3D {

static void _calc_output_vol(const Vector3 &source_dir, real_t tightness, Vector<AudioFrame> &output);

void _calc_reverb_vol(Area3D *area, Vector3 listener_area_pos, Vector<AudioFrame> direct_path_vol, Vector<AudioFrame> &reverb_vol);
void _calc_reverb_vol(Area3D *area, Vector3 listener_area_pos, const Vector<AudioFrame> &direct_path_vol, Vector<AudioFrame> &reverb_vol);

static void _listener_changed_cb(void *self) { reinterpret_cast<AudioStreamPlayer3D *>(self)->force_update_panning = true; }

Expand Down
2 changes: 1 addition & 1 deletion scene/3d/bone_attachment_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void BoneAttachment3D::on_skeleton_update() {
updating = false;
}
#ifdef TOOLS_ENABLED
void BoneAttachment3D::notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, Dictionary p_rename_map) {
void BoneAttachment3D::notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, const Dictionary &p_rename_map) {
const Skeleton3D *parent = nullptr;
if (use_external_skeleton) {
if (external_skeleton_node_cache.is_valid()) {
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/bone_attachment_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BoneAttachment3D : public Node3D {

public:
#ifdef TOOLS_ENABLED
virtual void notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, Dictionary p_rename_map);
virtual void notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, const Dictionary &p_rename_map);
#endif // TOOLS_ENABLED

virtual PackedStringArray get_configuration_warnings() const override;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/label_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ TextServer::StructuredTextParser Label3D::get_structured_text_bidi_override() co
return st_parser;
}

void Label3D::set_structured_text_bidi_override_options(Array p_args) {
void Label3D::set_structured_text_bidi_override_options(const Array &p_args) {
if (st_args != p_args) {
st_args = p_args;
dirty_text = true;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/label_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class Label3D : public GeometryInstance3D {
void set_structured_text_bidi_override(TextServer::StructuredTextParser p_parser);
TextServer::StructuredTextParser get_structured_text_bidi_override() const;

void set_structured_text_bidi_override_options(Array p_args);
void set_structured_text_bidi_override_options(const Array &p_args);
Array get_structured_text_bidi_override_options() const;

void set_uppercase(bool p_uppercase);
Expand Down
8 changes: 4 additions & 4 deletions scene/3d/occluder_instance_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ Occluder3D::~Occluder3D() {

/////////////////////////////////////////////////

void ArrayOccluder3D::set_arrays(PackedVector3Array p_vertices, PackedInt32Array p_indices) {
void ArrayOccluder3D::set_arrays(const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices) {
vertices = p_vertices;
indices = p_indices;
_update();
}

void ArrayOccluder3D::set_vertices(PackedVector3Array p_vertices) {
void ArrayOccluder3D::set_vertices(const PackedVector3Array &p_vertices) {
vertices = p_vertices;
_update();
}

void ArrayOccluder3D::set_indices(PackedInt32Array p_indices) {
void ArrayOccluder3D::set_indices(const PackedInt32Array &p_indices) {
indices = p_indices;
_update();
}
Expand Down Expand Up @@ -512,7 +512,7 @@ bool OccluderInstance3D::_bake_material_check(Ref<Material> p_material) {
return true;
}

void OccluderInstance3D::_bake_surface(const Transform3D &p_transform, Array p_surface_arrays, Ref<Material> p_material, float p_simplification_dist, PackedVector3Array &r_vertices, PackedInt32Array &r_indices) {
void OccluderInstance3D::_bake_surface(const Transform3D &p_transform, const Array &p_surface_arrays, Ref<Material> p_material, float p_simplification_dist, PackedVector3Array &r_vertices, PackedInt32Array &r_indices) {
if (!_bake_material_check(p_material)) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions scene/3d/occluder_instance_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class ArrayOccluder3D : public Occluder3D {
static void _bind_methods();

public:
void set_arrays(PackedVector3Array p_vertices, PackedInt32Array p_indices);
void set_vertices(PackedVector3Array p_vertices);
void set_indices(PackedInt32Array p_indices);
void set_arrays(const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices);
void set_vertices(const PackedVector3Array &p_vertices);
void set_indices(const PackedInt32Array &p_indices);

ArrayOccluder3D();
~ArrayOccluder3D();
Expand Down Expand Up @@ -170,7 +170,7 @@ class OccluderInstance3D : public VisualInstance3D {
void _occluder_changed();

static bool _bake_material_check(Ref<Material> p_material);
static void _bake_surface(const Transform3D &p_transform, Array p_surface_arrays, Ref<Material> p_material, float p_simplification_dist, PackedVector3Array &r_vertices, PackedInt32Array &r_indices);
static void _bake_surface(const Transform3D &p_transform, const Array &p_surface_arrays, Ref<Material> p_material, float p_simplification_dist, PackedVector3Array &r_vertices, PackedInt32Array &r_indices);
void _bake_node(Node *p_node, PackedVector3Array &r_vertices, PackedInt32Array &r_indices);

bool _is_editable_3d_polygon() const;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/soft_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ const NodePath &SoftBody3D::get_parent_collision_ignore() const {
return parent_collision_ignore;
}

void SoftBody3D::set_pinned_points_indices(Vector<SoftBody3D::PinnedPoint> p_pinned_points_indices) {
void SoftBody3D::set_pinned_points_indices(const Vector<SoftBody3D::PinnedPoint> &p_pinned_points_indices) {
pinned_points = p_pinned_points_indices;
for (int i = pinned_points.size() - 1; 0 <= i; --i) {
pin_point(p_pinned_points_indices[i].point_index, true);
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/soft_body_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class SoftBody3D : public MeshInstance3D {
void set_parent_collision_ignore(const NodePath &p_parent_collision_ignore);
const NodePath &get_parent_collision_ignore() const;

void set_pinned_points_indices(Vector<PinnedPoint> p_pinned_points_indices);
void set_pinned_points_indices(const Vector<PinnedPoint> &p_pinned_points_indices);
Vector<PinnedPoint> get_pinned_points_indices();

void set_simulation_precision(int p_simulation_precision);
Expand Down
6 changes: 3 additions & 3 deletions scene/animation/animation_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,15 +947,15 @@ void AnimationMixer::_process_animation(double p_delta, bool p_update_only) {
clear_animation_instances();
}

Variant AnimationMixer::post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, ObjectID p_object_id, int p_object_sub_idx) {
Variant AnimationMixer::post_process_key_value(const Ref<Animation> &p_anim, int p_track, const Variant &p_value, ObjectID p_object_id, int p_object_sub_idx) {
Variant res;
if (GDVIRTUAL_CALL(_post_process_key_value, p_anim, p_track, p_value, p_object_id, p_object_sub_idx, res)) {
return res;
}
return _post_process_key_value(p_anim, p_track, p_value, p_object_id, p_object_sub_idx);
}

Variant AnimationMixer::_post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, ObjectID p_object_id, int p_object_sub_idx) {
Variant AnimationMixer::_post_process_key_value(const Ref<Animation> &p_anim, int p_track, const Variant &p_value, ObjectID p_object_id, int p_object_sub_idx) {
#ifndef _3D_DISABLED
switch (p_anim->track_get_type(p_track)) {
case Animation::TYPE_POSITION_3D: {
Expand Down Expand Up @@ -2348,7 +2348,7 @@ AnimationMixer::AnimationMixer() {
AnimationMixer::~AnimationMixer() {
}

void AnimatedValuesBackup::set_data(const HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> p_data) {
void AnimatedValuesBackup::set_data(const HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> &p_data) {
clear_data();

for (const KeyValue<Animation::TypeHash, AnimationMixer::TrackCache *> &E : p_data) {
Expand Down
6 changes: 3 additions & 3 deletions scene/animation/animation_mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ class AnimationMixer : public Node {
virtual void _process_animation(double p_delta, bool p_update_only = false);

// For post process with retrieved key value during blending.
virtual Variant _post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, ObjectID p_object_id, int p_object_sub_idx = -1);
Variant post_process_key_value(const Ref<Animation> &p_anim, int p_track, Variant p_value, ObjectID p_object_id, int p_object_sub_idx = -1);
virtual Variant _post_process_key_value(const Ref<Animation> &p_anim, int p_track, const Variant &p_value, ObjectID p_object_id, int p_object_sub_idx = -1);
Variant post_process_key_value(const Ref<Animation> &p_anim, int p_track, const Variant &p_value, ObjectID p_object_id, int p_object_sub_idx = -1);
GDVIRTUAL5RC(Variant, _post_process_key_value, Ref<Animation>, int, Variant, ObjectID, int);

void _blend_init();
Expand Down Expand Up @@ -485,7 +485,7 @@ class AnimatedValuesBackup : public RefCounted {
HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> data;

public:
void set_data(const HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> p_data);
void set_data(const HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> &p_data);
HashMap<Animation::TypeHash, AnimationMixer::TrackCache *> get_data() const;
void clear_data();

Expand Down
2 changes: 1 addition & 1 deletion scene/animation/tween.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Ref<CallbackTweener> Tween::tween_callback(const Callable &p_callback) {
return tweener;
}

Ref<MethodTweener> Tween::tween_method(const Callable &p_callback, const Variant p_from, Variant p_to, double p_duration) {
Ref<MethodTweener> Tween::tween_method(const Callable &p_callback, const Variant &p_from, Variant p_to, double p_duration) {
CHECK_VALID();

if (!_validate_type_match(p_from, p_to)) {
Expand Down
2 changes: 1 addition & 1 deletion scene/animation/tween.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Tween : public RefCounted {
Ref<PropertyTweener> tween_property(const Object *p_target, const NodePath &p_property, Variant p_to, double p_duration);
Ref<IntervalTweener> tween_interval(double p_time);
Ref<CallbackTweener> tween_callback(const Callable &p_callback);
Ref<MethodTweener> tween_method(const Callable &p_callback, const Variant p_from, Variant p_to, double p_duration);
Ref<MethodTweener> tween_method(const Callable &p_callback, const Variant &p_from, Variant p_to, double p_duration);
void append(Ref<Tweener> p_tweener);

bool custom_step(double p_delta);
Expand Down
2 changes: 1 addition & 1 deletion scene/debugger/scene_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class SceneDebuggerTree {
VIEW_VISIBLE_IN_TREE = 1 << 3,
};

RemoteNode(int p_child, const String &p_name, const String &p_type, ObjectID p_id, const String p_scene_file_path, int p_view_flags) {
RemoteNode(int p_child, const String &p_name, const String &p_type, ObjectID p_id, const String &p_scene_file_path, int p_view_flags) {
child_count = p_child;
name = p_name;
type_name = p_type;
Expand Down
6 changes: 3 additions & 3 deletions scene/gui/dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ String AcceptDialog::get_text() const {
return message_label->get_text();
}

void AcceptDialog::set_text(String p_text) {
void AcceptDialog::set_text(const String &p_text) {
if (message_label->get_text() == p_text) {
return;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ bool AcceptDialog::has_autowrap() {
return message_label->get_autowrap_mode() != TextServer::AUTOWRAP_OFF;
}

void AcceptDialog::set_ok_button_text(String p_ok_button_text) {
void AcceptDialog::set_ok_button_text(const String &p_ok_button_text) {
ok_button->set_text(p_ok_button_text);

child_controls_changed();
Expand Down Expand Up @@ -459,7 +459,7 @@ AcceptDialog::~AcceptDialog() {

// ConfirmationDialog

void ConfirmationDialog::set_cancel_button_text(String p_cancel_button_text) {
void ConfirmationDialog::set_cancel_button_text(const String &p_cancel_button_text) {
cancel->set_text(p_cancel_button_text);
}

Expand Down
6 changes: 3 additions & 3 deletions scene/gui/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ class AcceptDialog : public Window {
void set_close_on_escape(bool p_enable);
bool get_close_on_escape() const;

void set_text(String p_text);
void set_text(const String &p_text);
String get_text() const;

void set_autowrap(bool p_autowrap);
bool has_autowrap();

void set_ok_button_text(String p_ok_button_text);
void set_ok_button_text(const String &p_ok_button_text);
String get_ok_button_text() const;

AcceptDialog();
Expand All @@ -134,7 +134,7 @@ class ConfirmationDialog : public AcceptDialog {
public:
Button *get_cancel_button();

void set_cancel_button_text(String p_cancel_button_text);
void set_cancel_button_text(const String &p_cancel_button_text);
String get_cancel_button_text() const;

ConfirmationDialog();
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void FileDialog::update_dir() {
deselect_all();
}

void FileDialog::_dir_submitted(String p_dir) {
void FileDialog::_dir_submitted(const String &p_dir) {
_change_dir(root_prefix.path_join(p_dir));
file->set_text("");
_push_history();
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class FileDialog : public ConfirmationDialog {

void _select_drive(int p_idx);
void _tree_item_activated();
void _dir_submitted(String p_dir);
void _dir_submitted(const String &p_dir);
void _file_submitted(const String &p_file);
void _action_pressed();
void _save_confirm_pressed();
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ TextServer::StructuredTextParser Label::get_structured_text_bidi_override() cons
return st_parser;
}

void Label::set_structured_text_bidi_override_options(Array p_args) {
void Label::set_structured_text_bidi_override_options(const Array &p_args) {
if (st_args == p_args) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/label.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Label : public Control {
void set_structured_text_bidi_override(TextServer::StructuredTextParser p_parser);
TextServer::StructuredTextParser get_structured_text_bidi_override() const;

void set_structured_text_bidi_override_options(Array p_args);
void set_structured_text_bidi_override_options(const Array &p_args);
Array get_structured_text_bidi_override_options() const;

void set_autowrap_mode(TextServer::AutowrapMode p_mode);
Expand Down
6 changes: 3 additions & 3 deletions scene/gui/line_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
}
}

void LineEdit::set_text(String p_text) {
void LineEdit::set_text(const String &p_text) {
clear_internal();
insert_text_at_caret(p_text);
_create_undo_state();
Expand Down Expand Up @@ -1626,7 +1626,7 @@ TextServer::StructuredTextParser LineEdit::get_structured_text_bidi_override() c
return st_parser;
}

void LineEdit::set_structured_text_bidi_override_options(Array p_args) {
void LineEdit::set_structured_text_bidi_override_options(const Array &p_args) {
st_args = p_args;
_shape();
queue_redraw();
Expand Down Expand Up @@ -1660,7 +1660,7 @@ String LineEdit::get_text() const {
return text;
}

void LineEdit::set_placeholder(String p_text) {
void LineEdit::set_placeholder(const String &p_text) {
if (placeholder == p_text) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions scene/gui/line_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class LineEdit : public Control {
void delete_char();
void delete_text(int p_from_column, int p_to_column);

void set_text(String p_text);
void set_text(const String &p_text);
String get_text() const;
void set_text_with_selection(const String &p_text); // Set text, while preserving selection.

Expand All @@ -300,10 +300,10 @@ class LineEdit : public Control {
void set_structured_text_bidi_override(TextServer::StructuredTextParser p_parser);
TextServer::StructuredTextParser get_structured_text_bidi_override() const;

void set_structured_text_bidi_override_options(Array p_args);
void set_structured_text_bidi_override_options(const Array &p_args);
Array get_structured_text_bidi_override_options() const;

void set_placeholder(String p_text);
void set_placeholder(const String &p_text);
String get_placeholder() const;

void set_caret_column(int p_column);
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/link_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ TextServer::StructuredTextParser LinkButton::get_structured_text_bidi_override()
return st_parser;
}

void LinkButton::set_structured_text_bidi_override_options(Array p_args) {
void LinkButton::set_structured_text_bidi_override_options(const Array &p_args) {
st_args = p_args;
_shape();
queue_redraw();
Expand Down
Loading
Loading