From d6225b1e0004c57cc50452ddb5d512fd6556a523 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 22 Jun 2016 23:12:20 -0300 Subject: [PATCH] Improved binding system (ObjectTypeDB::bind_method) to be friendlier to statically typed languages, should help in the Mono integration. Disabled by default. --- bin/tests/test_math.cpp | 7 + core/io/http_client.cpp | 2 - core/io/http_client.h | 1 + core/make_binders.py | 15 +- core/math/bsp_tree.h | 27 +- core/math/face3.h | 2 + core/method_bind.h | 40 ++ core/method_ptrcall.h | 354 ++++++++++++++++++ core/reference.h | 56 +++ .../javascript/audio_server_javascript.cpp | 2 +- platform/javascript/audio_server_javascript.h | 2 +- scene/resources/dynamic_font.cpp | 4 +- scene/resources/dynamic_font.h | 4 +- scene/resources/dynamic_font_stb.cpp | 4 +- scene/resources/dynamic_font_stb.h | 4 +- scene/resources/font.cpp | 2 +- scene/resources/font.h | 4 +- scene/resources/room.cpp | 2 +- scene/resources/room.h | 2 +- servers/audio/audio_server_sw.cpp | 2 +- servers/audio/audio_server_sw.h | 2 +- servers/audio_server.h | 2 +- 22 files changed, 517 insertions(+), 23 deletions(-) create mode 100644 core/method_ptrcall.h diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp index 22d14ada34b..9110f726200 100644 --- a/bin/tests/test_math.cpp +++ b/bin/tests/test_math.cpp @@ -40,6 +40,9 @@ #include "scene/resources/texture.h" #include "vmap.h" #include "os/os.h" + +#include "method_ptrcall.h" + namespace TestMath { @@ -105,8 +108,12 @@ uint32_t ihash3( uint32_t a) return a; } + + + MainLoop* test() { + return NULL; { diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 0dfae6584b1..2a831dd9923 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -29,8 +29,6 @@ #include "http_client.h" #include "io/stream_peer_ssl.h" -VARIANT_ENUM_CAST(HTTPClient::Status); - Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ diff --git a/core/io/http_client.h b/core/io/http_client.h index ceb0273a7d2..32d2e721015 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -201,5 +201,6 @@ public: }; VARIANT_ENUM_CAST(HTTPClient::Method); +VARIANT_ENUM_CAST(HTTPClient::Status); #endif // HTTP_CLIENT_H diff --git a/core/make_binders.py b/core/make_binders.py index 93371dc0a31..1d55c92b890 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -48,7 +48,13 @@ public: $ifnoret return Variant();$ } - +#ifdef PTRCAL_ENABLED + virtual void ptrcall(Object*p_object,const void** p_args,void *r_ret) { + + T *instance=p_object->cast_to(); + $ifret PtrToArg::encode( $ (instance->*method)($arg, PtrToArg::convert(p_args[@-1])$) $ifret ,r_ret)$ ; + } +#endif MethodBind$argc$$ifret R$$ifconst C$ () { #ifdef DEBUG_METHODS_ENABLED _set_const($ifconst true$$ifnoconst false$); @@ -121,7 +127,12 @@ public: $ifret return Variant(ret);$ $ifnoret return Variant();$ } - +#ifdef PTRCALL_ENABLED + virtual void ptrcall(Object*p_object,const void** p_args,void *r_ret) { + __UnexistingClass *instance = (__UnexistingClass*)p_object; + $ifret PtrToArg::encode( $ (instance->*method)($arg, PtrToArg::convert(p_args[@-1])$) $ifret ,r_ret) $ ; + } +#endif MethodBind$argc$$ifret R$$ifconst C$ () { #ifdef DEBUG_METHODS_ENABLED _set_const($ifconst true$$ifnoconst false$); diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h index 2bfc26b51e9..6c36d80e3e9 100644 --- a/core/math/bsp_tree.h +++ b/core/math/bsp_tree.h @@ -34,8 +34,8 @@ #include "face3.h" #include "vector.h" #include "dvector.h" - #include "variant.h" +#include "method_ptrcall.h" /** @author Juan Linietsky */ @@ -138,4 +138,29 @@ bool BSP_Tree::convex_is_inside(const T& p_convex) const { } +#ifdef PTRCALL_ENABLED + + +template<> +struct PtrToArg { + _FORCE_INLINE_ static BSP_Tree convert(const void* p_ptr) { + BSP_Tree s( Variant( *reinterpret_cast(p_ptr) ) ); + return s; + } + _FORCE_INLINE_ static void encode(BSP_Tree p_val,void* p_ptr) { + Dictionary *d = reinterpret_cast(p_ptr); + *d=Variant(p_val); + } +}; + +template<> +struct PtrToArg { + _FORCE_INLINE_ static BSP_Tree convert(const void* p_ptr) { + BSP_Tree s( Variant( *reinterpret_cast(p_ptr) ) ); + return s; + } +}; + +#endif + #endif diff --git a/core/math/face3.h b/core/math/face3.h index bc34be99354..3a81da74dbc 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -264,4 +264,6 @@ bool Face3::intersects_aabb2(const AABB& p_aabb) const { } +//this sucks... + #endif // FACE3_H diff --git a/core/method_bind.h b/core/method_bind.h index 48848c58486..30a848270d8 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -33,6 +33,7 @@ #include "variant.h" #include "object.h" #include +#include "method_ptrcall.h" /** @author Juan Linietsky @@ -85,6 +86,32 @@ struct VariantCaster { (VariantCaster::cast( (m_idx-1)>=p_arg_count?get_default_argument(m_idx-1):*p_args[m_idx-1] )) //SIMPLE_NUMERIC_TYPE is used to avoid a warning on Variant::get_type_for + +#ifdef PTRCALL_ENABLED + + +#define VARIANT_ENUM_CAST( m_enum ) \ +SIMPLE_NUMERIC_TYPE( m_enum );\ +template<> \ +struct VariantCaster {\ +\ + static _FORCE_INLINE_ m_enum cast(const Variant& p_variant) {\ + return (m_enum)p_variant.operator int();\ + }\ +};\ +template<>\ +struct PtrToArg< m_enum > {\ + _FORCE_INLINE_ static m_enum convert(const void* p_ptr) {\ + return m_enum(*reinterpret_cast(p_ptr));\ + }\ + _FORCE_INLINE_ static void encode(m_enum p_val,const void* p_ptr) {\ + *(int*)p_ptr=p_val;\ + }\ +}; + +#else + + #define VARIANT_ENUM_CAST( m_enum ) \ SIMPLE_NUMERIC_TYPE( m_enum );\ template<> \ @@ -96,6 +123,9 @@ struct VariantCaster {\ }; +#endif + + #define CHECK_ARG(m_arg)\ if ((m_arg-1) +struct PtrToArg { + +}; + +#define MAKE_PTRARG(m_type) \ +template<>\ +struct PtrToArg {\ + _FORCE_INLINE_ static m_type convert(const void* p_ptr) {\ + return *reinterpret_cast(p_ptr);\ + }\ + _FORCE_INLINE_ static void encode(m_type p_val, void* p_ptr) {\ + *((m_type*)p_ptr)=p_val;\ + }\ +};\ +template<>\ +struct PtrToArg {\ + _FORCE_INLINE_ static m_type convert(const void* p_ptr) {\ + return *reinterpret_cast(p_ptr);\ + }\ + _FORCE_INLINE_ static void encode(m_type p_val, void* p_ptr) {\ + *((m_type*)p_ptr)=p_val;\ + }\ +} + + +#define MAKE_PTRARGR(m_type,m_ret) \ +template<>\ +struct PtrToArg {\ + _FORCE_INLINE_ static m_type convert(const void* p_ptr) {\ + return *reinterpret_cast(p_ptr);\ + }\ + _FORCE_INLINE_ static void encode(m_type p_val, void* p_ptr) {\ + *((m_ret*)p_ptr)=p_val;\ + }\ +};\ +template<>\ +struct PtrToArg {\ + _FORCE_INLINE_ static m_type convert(const void* p_ptr) {\ + return *reinterpret_cast(p_ptr);\ + }\ + _FORCE_INLINE_ static void encode(m_type p_val, void* p_ptr) {\ + *((m_ret*)p_ptr)=p_val;\ + }\ +} + + + +MAKE_PTRARG(bool); +MAKE_PTRARGR(uint8_t,int); +MAKE_PTRARGR(int8_t,int); +MAKE_PTRARGR(uint16_t,int); +MAKE_PTRARGR(int16_t,int); +MAKE_PTRARGR(uint32_t,int); +MAKE_PTRARGR(int32_t,int); +MAKE_PTRARGR(int64_t,int); +MAKE_PTRARGR(uint64_t,int); +MAKE_PTRARG(float); +MAKE_PTRARGR(double,float); + +MAKE_PTRARG(String); +MAKE_PTRARG(Vector2); +MAKE_PTRARG(Rect2); +MAKE_PTRARG(Vector3); +MAKE_PTRARG(Matrix32); +MAKE_PTRARG(Plane); +MAKE_PTRARG(Quat); +MAKE_PTRARG(AABB); +MAKE_PTRARG(Matrix3); +MAKE_PTRARG(Transform); +MAKE_PTRARG(Color); +MAKE_PTRARG(Image); +MAKE_PTRARG(NodePath); +MAKE_PTRARG(RID); +MAKE_PTRARG(InputEvent); +MAKE_PTRARG(Dictionary); +MAKE_PTRARG(Array); +MAKE_PTRARG(ByteArray); +MAKE_PTRARG(IntArray); +MAKE_PTRARG(RealArray); +MAKE_PTRARG(StringArray); +MAKE_PTRARG(Vector2Array); +MAKE_PTRARG(Vector3Array); +MAKE_PTRARG(ColorArray); +MAKE_PTRARG(Variant); + + +//this is for Object + +template +struct PtrToArg< T* > { + + _FORCE_INLINE_ static T* convert(const void* p_ptr) { + + return const_cast(reinterpret_cast(p_ptr)); + } + + _FORCE_INLINE_ static void encode(T* p_var, void* p_ptr) { + + *((T**)p_ptr)=p_var; + } + +}; + +template +struct PtrToArg< const T* > { + + _FORCE_INLINE_ static const T* convert(const void* p_ptr) { + + return reinterpret_cast(p_ptr); + } + + _FORCE_INLINE_ static void encode(T* p_var, void* p_ptr) { + + *((T**)p_ptr)=p_var; + } + +}; + + +//this is for the special cases used by Variant + +#define MAKE_VECARG(m_type) \ +template<>\ +struct PtrToArg > {\ + _FORCE_INLINE_ static Vector convert(const void* p_ptr) {\ + const DVector *dvs = reinterpret_cast *>(p_ptr);\ + Vector ret;\ + int len = dvs->size();\ + ret.resize(len);\ + {\ + DVector::Read r=dvs->read();\ + for(int i=0;i p_vec, void* p_ptr) {\ + DVector *dv = reinterpret_cast *>(p_ptr);\ + int len=p_vec.size();\ + dv->resize(len);\ + {\ + DVector::Write w=dv->write();\ + for(int i=0;i\ +struct PtrToArg& > {\ + _FORCE_INLINE_ static Vector convert(const void* p_ptr) {\ + const DVector *dvs = reinterpret_cast *>(p_ptr);\ + Vector ret;\ + int len = dvs->size();\ + ret.resize(len);\ + {\ + DVector::Read r=dvs->read();\ + for(int i=0;i\ +struct PtrToArg > {\ + _FORCE_INLINE_ static Vector convert(const void* p_ptr) {\ + const Array *arr = reinterpret_cast(p_ptr);\ + Vector ret;\ + int len = arr->size();\ + ret.resize(len);\ + for(int i=0;i p_vec, void* p_ptr) {\ + Array *arr = reinterpret_cast(p_ptr);\ + int len = p_vec.size();\ + arr->resize(len);\ + for(int i=0;i\ +struct PtrToArg& > {\ + _FORCE_INLINE_ static Vector convert(const void* p_ptr) {\ + const Array *arr = reinterpret_cast(p_ptr);\ + Vector ret;\ + int len = arr->size();\ + ret.resize(len);\ + for(int i=0;i\ +struct PtrToArg > {\ + _FORCE_INLINE_ static DVector convert(const void* p_ptr) {\ + const Array *arr = reinterpret_cast(p_ptr);\ + DVector ret;\ + int len = arr->size();\ + ret.resize(len);\ + {\ + DVector::Write w=ret.write();\ + for(int i=0;i p_vec, void* p_ptr) {\ + Array *arr = reinterpret_cast(p_ptr);\ + int len = p_vec.size();\ + arr->resize(len);\ + {\ + DVector::Read r=p_vec.read();\ + for(int i=0;i\ +struct PtrToArg& > {\ + _FORCE_INLINE_ static DVector convert(const void* p_ptr) {\ + const Array *arr = reinterpret_cast(p_ptr);\ + DVector ret;\ + int len = arr->size();\ + ret.resize(len);\ + {\ + DVector::Write w=ret.write();\ + for(int i=0;i\ +struct PtrToArg {\ + _FORCE_INLINE_ static m_type convert(const void* p_ptr) {\ + m_type s = *reinterpret_cast(p_ptr);\ + return s;\ + }\ + _FORCE_INLINE_ static void encode(m_type p_vec, void* p_ptr) {\ + String *arr = reinterpret_cast(p_ptr);\ + *arr=p_vec;\ + }\ +};\ +\ +template<>\ +struct PtrToArg {\ + _FORCE_INLINE_ static m_type convert(const void* p_ptr) {\ + m_type s = *reinterpret_cast(p_ptr);\ + return s;\ + }\ +} + +MAKE_STRINGCONV(StringName); +MAKE_STRINGCONV(IP_Address); + +template<> +struct PtrToArg > { + _FORCE_INLINE_ static DVector convert(const void* p_ptr) { + const DVector *dvs = reinterpret_cast *>(p_ptr); + DVector ret; + int len = dvs->size()/3; + ret.resize(len); + { + DVector::Read r=dvs->read(); + DVector::Write w=ret.write(); + for(int i=0;i p_vec, void* p_ptr) {\ + DVector *arr = reinterpret_cast *>(p_ptr);\ + int len = p_vec.size();\ + arr->resize(len*3);\ + {\ + DVector::Read r=p_vec.read();\ + DVector::Write w=arr->write();\ + for(int i=0;i +struct PtrToArg& > { + _FORCE_INLINE_ static DVector convert(const void* p_ptr) { + const DVector *dvs = reinterpret_cast *>(p_ptr); + DVector ret; + int len = dvs->size()/3; + ret.resize(len); + { + DVector::Read r=dvs->read(); + DVector::Write w=ret.write(); + for(int i=0;i +struct PtrToArg< Ref > { + + _FORCE_INLINE_ static Ref convert(const void* p_ptr) { + + return Ref(reinterpret_cast(p_ptr)); + } + + _FORCE_INLINE_ static void encode(Ref p_val,const void* p_ptr) { + + *((T**)p_ptr)=p_val.ptr(); + } + +}; +template +struct PtrToArg< const Ref& > { + + _FORCE_INLINE_ static Ref convert(const void* p_ptr) { + + return Ref(reinterpret_cast(p_ptr)); + } + +}; + + +//this is for RefPtr + +template<> +struct PtrToArg< RefPtr > { + + _FORCE_INLINE_ static RefPtr convert(const void* p_ptr) { + + return Ref(reinterpret_cast(p_ptr)).get_ref_ptr(); + } + + _FORCE_INLINE_ static void encode(RefPtr p_val,const void* p_ptr) { + + Ref r = p_val; + *((Reference**)p_ptr)=r.ptr(); + } + +}; + +template<> +struct PtrToArg< const RefPtr& > { + + _FORCE_INLINE_ static RefPtr convert(const void* p_ptr) { + + return Ref(reinterpret_cast(p_ptr)).get_ref_ptr(); + } + +}; + +#endif #endif // REFERENCE_H diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index 9f82f084e5e..71a7e77266f 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -116,7 +116,7 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector } -const DVector AudioServerJavascript::sample_get_data(RID p_sample) const{ +DVector AudioServerJavascript::sample_get_data(RID p_sample) const{ return DVector(); diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index bb9a91f78af..e27192cd93d 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -132,7 +132,7 @@ public: virtual void sample_set_data(RID p_sample, const DVector& p_buffer); - virtual const DVector sample_get_data(RID p_sample) const; + virtual DVector sample_get_data(RID p_sample) const; virtual void sample_set_mix_rate(RID p_sample,int p_rate); virtual int sample_get_mix_rate(RID p_sample) const; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index bb40c5ed930..c3b40f7add6 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -271,7 +271,7 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char,CharType p_next,const Vec } -float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate,const Vector >& p_fallbacks) const { +float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next,const Color& p_modulate,const Vector >& p_fallbacks) const { if (!valid) return 0; @@ -686,7 +686,7 @@ bool DynamicFont::is_distance_field_hint() const{ return false; } -float DynamicFont::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { +float DynamicFont::draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next,const Color& p_modulate) const { if (!data_at_size.is_valid()) return 0; diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 508d6302186..9ad1b4edbfe 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -143,7 +143,7 @@ public: Size2 get_char_size(CharType p_char,CharType p_next,const Vector >& p_fallbacks) const; - float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate,const Vector >& p_fallbacks) const; + float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next,const Color& p_modulate,const Vector >& p_fallbacks) const; @@ -199,7 +199,7 @@ public: virtual bool is_distance_field_hint() const; - virtual float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; + virtual float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const; DynamicFont(); ~DynamicFont(); diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index 0b9f95da4f0..456e6a5ee78 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -142,7 +142,7 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char,CharType p_next) const { } -float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { +float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next,const Color& p_modulate) const { const_cast(this)->_update_char(p_char); @@ -455,7 +455,7 @@ bool DynamicFont::is_distance_field_hint() const{ return false; } -float DynamicFont::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { +float DynamicFont::draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next,const Color& p_modulate) const { if (!data_at_size.is_valid()) return 0; diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h index 6b72fb37033..136edff2fc3 100644 --- a/scene/resources/dynamic_font_stb.h +++ b/scene/resources/dynamic_font_stb.h @@ -112,7 +112,7 @@ public: Size2 get_char_size(CharType p_char,CharType p_next=0) const; - float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; + float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const; @@ -152,7 +152,7 @@ public: virtual bool is_distance_field_hint() const; - virtual float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; + virtual float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const; DynamicFont(); ~DynamicFont(); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 0d8d2240378..6ad8a955658 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -506,7 +506,7 @@ Ref BitmapFont::get_fallback() const{ return fallback; } -float BitmapFont::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next,const Color& p_modulate) const { +float BitmapFont::draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char, CharType p_next, const Color& p_modulate) const { const Character * c = char_map.getptr(p_char); diff --git a/scene/resources/font.h b/scene/resources/font.h index 91f4874932c..67836564cdc 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -59,7 +59,7 @@ public: void draw(RID p_canvas_item, const Point2& p_pos, const String& p_text,const Color& p_modulate=Color(1,1,1),int p_clip_w=-1) const; void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const; - virtual float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const=0; + virtual float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char, CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const=0; Font(); @@ -155,7 +155,7 @@ public: void set_distance_field_hint(bool p_distance_field); bool is_distance_field_hint() const; - float draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_char,const CharType& p_next=0,const Color& p_modulate=Color(1,1,1)) const; + float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char,CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const; BitmapFont(); ~BitmapFont(); diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp index d1fc614c903..f28220531b6 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -52,7 +52,7 @@ void RoomBounds::set_geometry_hint(const DVector& p_geometry_hint) { geometry_hint=p_geometry_hint; } -const DVector& RoomBounds::get_geometry_hint() const { +DVector RoomBounds::get_geometry_hint() const { return geometry_hint; } diff --git a/scene/resources/room.h b/scene/resources/room.h index 3ed41a3e618..dc5e2848383 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -56,7 +56,7 @@ public: BSP_Tree get_bounds() const; void set_geometry_hint(const DVector& geometry_hint); - const DVector& get_geometry_hint() const; + DVector get_geometry_hint() const; RoomBounds(); ~RoomBounds(); diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index 8b5b5e4f46a..853714be2a0 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -388,7 +388,7 @@ void AudioServerSW::sample_set_data(RID p_sample, const DVector& p_buff AUDIO_LOCK sample_manager->sample_set_data(p_sample,p_buffer); } -const DVector AudioServerSW::sample_get_data(RID p_sample) const { +DVector AudioServerSW::sample_get_data(RID p_sample) const { AUDIO_LOCK return sample_manager->sample_get_data(p_sample); } diff --git a/servers/audio/audio_server_sw.h b/servers/audio/audio_server_sw.h index 8d3d992e2b5..fda952fa94c 100644 --- a/servers/audio/audio_server_sw.h +++ b/servers/audio/audio_server_sw.h @@ -126,7 +126,7 @@ public: const void* sample_get_data_ptr(RID p_sample) const; virtual void sample_set_data(RID p_sample, const DVector& p_buffer); - virtual const DVector sample_get_data(RID p_sample) const; + virtual DVector sample_get_data(RID p_sample) const; virtual void sample_set_mix_rate(RID p_sample,int p_rate); virtual int sample_get_mix_rate(RID p_sample) const; diff --git a/servers/audio_server.h b/servers/audio_server.h index c56820dcbbd..50194af4a53 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -169,7 +169,7 @@ public: virtual void sample_set_signed_data(RID p_sample, const DVector& p_buffer); virtual void sample_set_data(RID p_sample, const DVector& p_buffer)=0; - virtual const DVector sample_get_data(RID p_sample) const=0; + virtual DVector sample_get_data(RID p_sample) const=0; virtual void sample_set_mix_rate(RID p_sample,int p_rate)=0; virtual int sample_get_mix_rate(RID p_sample) const=0;