Change AudioStreamPlayer autoplay and GLTFBufferView getters to be const

This commit is contained in:
Aaron Franke 2024-01-06 20:29:43 -06:00
parent 41564aaf77
commit 35c99bbcc1
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
13 changed files with 243 additions and 16 deletions

View file

@ -82,3 +82,18 @@ Validate extension JSON: Error: Field 'classes/GPUParticles3D/properties/process
Validate extension JSON: Error: Field 'classes/Sky/properties/sky_material': type changed value in new API, from "ShaderMaterial,PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial" to "PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial,ShaderMaterial". Validate extension JSON: Error: Field 'classes/Sky/properties/sky_material': type changed value in new API, from "ShaderMaterial,PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial" to "PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial,ShaderMaterial".
Property hints reordered to improve editor usability. The types allowed are still the same as before. No adjustments should be necessary. Property hints reordered to improve editor usability. The types allowed are still the same as before. No adjustments should be necessary.
GH-86907
--------
Validate extension JSON: Error: Field 'classes/AudioStreamPlayer/methods/is_autoplay_enabled': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/AudioStreamPlayer2D/methods/is_autoplay_enabled': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/AudioStreamPlayer3D/methods/is_autoplay_enabled': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_buffer': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_length': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_offset': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_stride': is_const changed value in new API, from false to true.
Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_indices': is_const changed value in new API, from false to true.
Change AudioStreamPlayer* is_autoplay_enabled and GLTFBufferView getters to be const.

View file

@ -0,0 +1,61 @@
/**************************************************************************/
/* gltf_buffer_view.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISABLE_DEPRECATED
GLTFBufferIndex GLTFBufferView::_get_buffer_bind_compat_86907() {
return get_buffer();
}
int GLTFBufferView::_get_byte_offset_bind_compat_86907() {
return get_byte_offset();
}
int GLTFBufferView::_get_byte_length_bind_compat_86907() {
return get_byte_length();
}
int GLTFBufferView::_get_byte_stride_bind_compat_86907() {
return get_byte_stride();
}
bool GLTFBufferView::_get_indices_bind_compat_86907() {
return get_indices();
}
void GLTFBufferView::_bind_compatibility_methods() {
ClassDB::bind_compatibility_method(D_METHOD("get_buffer"), &GLTFBufferView::_get_buffer_bind_compat_86907);
ClassDB::bind_compatibility_method(D_METHOD("get_byte_offset"), &GLTFBufferView::_get_byte_offset_bind_compat_86907);
ClassDB::bind_compatibility_method(D_METHOD("get_byte_length"), &GLTFBufferView::_get_byte_length_bind_compat_86907);
ClassDB::bind_compatibility_method(D_METHOD("get_byte_stride"), &GLTFBufferView::_get_byte_stride_bind_compat_86907);
ClassDB::bind_compatibility_method(D_METHOD("get_indices"), &GLTFBufferView::_get_indices_bind_compat_86907);
}
#endif // DISABLE_DEPRECATED

View file

@ -29,6 +29,7 @@
/**************************************************************************/ /**************************************************************************/
#include "gltf_buffer_view.h" #include "gltf_buffer_view.h"
#include "gltf_buffer_view.compat.inc"
#include "../gltf_state.h" #include "../gltf_state.h"
@ -53,7 +54,7 @@ void GLTFBufferView::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "indices"), "set_indices", "get_indices"); // bool ADD_PROPERTY(PropertyInfo(Variant::BOOL, "indices"), "set_indices", "get_indices"); // bool
} }
GLTFBufferIndex GLTFBufferView::get_buffer() { GLTFBufferIndex GLTFBufferView::get_buffer() const {
return buffer; return buffer;
} }
@ -61,7 +62,7 @@ void GLTFBufferView::set_buffer(GLTFBufferIndex p_buffer) {
buffer = p_buffer; buffer = p_buffer;
} }
int GLTFBufferView::get_byte_offset() { int GLTFBufferView::get_byte_offset() const {
return byte_offset; return byte_offset;
} }
@ -69,7 +70,7 @@ void GLTFBufferView::set_byte_offset(int p_byte_offset) {
byte_offset = p_byte_offset; byte_offset = p_byte_offset;
} }
int GLTFBufferView::get_byte_length() { int GLTFBufferView::get_byte_length() const {
return byte_length; return byte_length;
} }
@ -77,7 +78,7 @@ void GLTFBufferView::set_byte_length(int p_byte_length) {
byte_length = p_byte_length; byte_length = p_byte_length;
} }
int GLTFBufferView::get_byte_stride() { int GLTFBufferView::get_byte_stride() const {
return byte_stride; return byte_stride;
} }
@ -85,7 +86,7 @@ void GLTFBufferView::set_byte_stride(int p_byte_stride) {
byte_stride = p_byte_stride; byte_stride = p_byte_stride;
} }
bool GLTFBufferView::get_indices() { bool GLTFBufferView::get_indices() const {
return indices; return indices;
} }

View file

@ -49,20 +49,29 @@ private:
protected: protected:
static void _bind_methods(); static void _bind_methods();
#ifndef DISABLE_DEPRECATED
GLTFBufferIndex _get_buffer_bind_compat_86907();
int _get_byte_offset_bind_compat_86907();
int _get_byte_length_bind_compat_86907();
int _get_byte_stride_bind_compat_86907();
bool _get_indices_bind_compat_86907();
static void _bind_compatibility_methods();
#endif // DISABLE_DEPRECATED
public: public:
GLTFBufferIndex get_buffer(); GLTFBufferIndex get_buffer() const;
void set_buffer(GLTFBufferIndex p_buffer); void set_buffer(GLTFBufferIndex p_buffer);
int get_byte_offset(); int get_byte_offset() const;
void set_byte_offset(int p_byte_offset); void set_byte_offset(int p_byte_offset);
int get_byte_length(); int get_byte_length() const;
void set_byte_length(int p_byte_length); void set_byte_length(int p_byte_length);
int get_byte_stride(); int get_byte_stride() const;
void set_byte_stride(int p_byte_stride); void set_byte_stride(int p_byte_stride);
bool get_indices(); bool get_indices() const;
void set_indices(bool p_indices); void set_indices(bool p_indices);
Vector<uint8_t> load_buffer_view_data(const Ref<GLTFState> p_state) const; Vector<uint8_t> load_buffer_view_data(const Ref<GLTFState> p_state) const;

View file

@ -0,0 +1,41 @@
/**************************************************************************/
/* audio_stream_player_2d.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISABLE_DEPRECATED
bool AudioStreamPlayer2D::_is_autoplay_enabled_bind_compat_86907() {
return is_autoplay_enabled();
}
void AudioStreamPlayer2D::_bind_compatibility_methods() {
ClassDB::bind_compatibility_method(D_METHOD("is_autoplay_enabled"), &AudioStreamPlayer2D::_is_autoplay_enabled_bind_compat_86907);
}
#endif // DISABLE_DEPRECATED

View file

@ -29,6 +29,7 @@
/**************************************************************************/ /**************************************************************************/
#include "audio_stream_player_2d.h" #include "audio_stream_player_2d.h"
#include "audio_stream_player_2d.compat.inc"
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "scene/2d/area_2d.h" #include "scene/2d/area_2d.h"
@ -251,7 +252,7 @@ void AudioStreamPlayer2D::set_autoplay(bool p_enable) {
internal->autoplay = p_enable; internal->autoplay = p_enable;
} }
bool AudioStreamPlayer2D::is_autoplay_enabled() { bool AudioStreamPlayer2D::is_autoplay_enabled() const {
return internal->autoplay; return internal->autoplay;
} }

View file

@ -89,6 +89,11 @@ protected:
bool _get(const StringName &p_name, Variant &r_ret) const; bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const; void _get_property_list(List<PropertyInfo> *p_list) const;
#ifndef DISABLE_DEPRECATED
bool _is_autoplay_enabled_bind_compat_86907();
static void _bind_compatibility_methods();
#endif // DISABLE_DEPRECATED
public: public:
void set_stream(Ref<AudioStream> p_stream); void set_stream(Ref<AudioStream> p_stream);
Ref<AudioStream> get_stream() const; Ref<AudioStream> get_stream() const;
@ -109,7 +114,7 @@ public:
StringName get_bus() const; StringName get_bus() const;
void set_autoplay(bool p_enable); void set_autoplay(bool p_enable);
bool is_autoplay_enabled(); bool is_autoplay_enabled() const;
void set_max_distance(float p_pixels); void set_max_distance(float p_pixels);
float get_max_distance() const; float get_max_distance() const;

View file

@ -0,0 +1,41 @@
/**************************************************************************/
/* audio_stream_player_3d.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISABLE_DEPRECATED
bool AudioStreamPlayer3D::_is_autoplay_enabled_bind_compat_86907() {
return is_autoplay_enabled();
}
void AudioStreamPlayer3D::_bind_compatibility_methods() {
ClassDB::bind_compatibility_method(D_METHOD("is_autoplay_enabled"), &AudioStreamPlayer3D::_is_autoplay_enabled_bind_compat_86907);
}
#endif // DISABLE_DEPRECATED

View file

@ -29,6 +29,7 @@
/**************************************************************************/ /**************************************************************************/
#include "audio_stream_player_3d.h" #include "audio_stream_player_3d.h"
#include "audio_stream_player_3d.compat.inc"
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "scene/3d/area_3d.h" #include "scene/3d/area_3d.h"
@ -571,7 +572,7 @@ void AudioStreamPlayer3D::set_autoplay(bool p_enable) {
internal->autoplay = p_enable; internal->autoplay = p_enable;
} }
bool AudioStreamPlayer3D::is_autoplay_enabled() { bool AudioStreamPlayer3D::is_autoplay_enabled() const {
return internal->autoplay; return internal->autoplay;
} }

View file

@ -121,6 +121,11 @@ protected:
bool _get(const StringName &p_name, Variant &r_ret) const; bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const; void _get_property_list(List<PropertyInfo> *p_list) const;
#ifndef DISABLE_DEPRECATED
bool _is_autoplay_enabled_bind_compat_86907();
static void _bind_compatibility_methods();
#endif // DISABLE_DEPRECATED
public: public:
void set_stream(Ref<AudioStream> p_stream); void set_stream(Ref<AudioStream> p_stream);
Ref<AudioStream> get_stream() const; Ref<AudioStream> get_stream() const;
@ -150,7 +155,7 @@ public:
int get_max_polyphony() const; int get_max_polyphony() const;
void set_autoplay(bool p_enable); void set_autoplay(bool p_enable);
bool is_autoplay_enabled(); bool is_autoplay_enabled() const;
void set_max_distance(float p_metres); void set_max_distance(float p_metres);
float get_max_distance() const; float get_max_distance() const;

View file

@ -0,0 +1,41 @@
/**************************************************************************/
/* audio_stream_player.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISABLE_DEPRECATED
bool AudioStreamPlayer::_is_autoplay_enabled_bind_compat_86907() {
return is_autoplay_enabled();
}
void AudioStreamPlayer::_bind_compatibility_methods() {
ClassDB::bind_compatibility_method(D_METHOD("is_autoplay_enabled"), &AudioStreamPlayer::_is_autoplay_enabled_bind_compat_86907);
}
#endif // DISABLE_DEPRECATED

View file

@ -29,6 +29,7 @@
/**************************************************************************/ /**************************************************************************/
#include "audio_stream_player.h" #include "audio_stream_player.h"
#include "audio_stream_player.compat.inc"
#include "scene/audio/audio_stream_player_internal.h" #include "scene/audio/audio_stream_player_internal.h"
#include "servers/audio/audio_stream.h" #include "servers/audio/audio_stream.h"
@ -126,7 +127,7 @@ void AudioStreamPlayer::set_autoplay(bool p_enable) {
internal->autoplay = p_enable; internal->autoplay = p_enable;
} }
bool AudioStreamPlayer::is_autoplay_enabled() { bool AudioStreamPlayer::is_autoplay_enabled() const {
return internal->autoplay; return internal->autoplay;
} }

View file

@ -67,6 +67,11 @@ protected:
bool _get(const StringName &p_name, Variant &r_ret) const; bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const; void _get_property_list(List<PropertyInfo> *p_list) const;
#ifndef DISABLE_DEPRECATED
bool _is_autoplay_enabled_bind_compat_86907();
static void _bind_compatibility_methods();
#endif // DISABLE_DEPRECATED
public: public:
void set_stream(Ref<AudioStream> p_stream); void set_stream(Ref<AudioStream> p_stream);
Ref<AudioStream> get_stream() const; Ref<AudioStream> get_stream() const;
@ -90,7 +95,7 @@ public:
StringName get_bus() const; StringName get_bus() const;
void set_autoplay(bool p_enable); void set_autoplay(bool p_enable);
bool is_autoplay_enabled(); bool is_autoplay_enabled() const;
void set_mix_target(MixTarget p_target); void set_mix_target(MixTarget p_target);
MixTarget get_mix_target() const; MixTarget get_mix_target() const;